#include <dpl/errno_string.h>
#include <dpl/wrt-dao-ro/widget_config.h>
-#include <dpl/utils/file_utils.h>
+#include <dpl/utils/wrt_utility.h>
#include <widget_install/job_widget_install.h>
#include <widget_install/widget_install_context.h>
#include <widget_install/widget_install_errors.h>
std::ostringstream widgetPath;
DPL::OptionalString pkgname = m_context.widgetConfig.pkgname;
if(!pkgname.IsNull()) {
- widgetPath << GlobalConfig::GetUserInstalledWidgetPath() << "/";
- widgetPath << pkgname << "/";
+ widgetPath << m_context.locations->getPackageInstallationDir() << "/";
} else {
ThrowMsg(Exceptions::InternalError, "No Package name exists.");
}
- if (access(widgetPath.str().c_str(), W_OK | X_OK) != 0) {
+ if (euidaccess(widgetPath.str().c_str(), W_OK | X_OK) != 0) {
ThrowMsg(Exceptions::InternalError, DPL::GetErrnoString());
}
storagePath << widgetPath.str().c_str()
<< GlobalConfig::GetWidgetPrivateStoragePath();
- if (access(storagePath.str().c_str(), F_OK) != 0) {
- FileUtils::MakePath(storagePath.str(), PRIVATE_STORAGE_MODE);
+ if (euidaccess(storagePath.str().c_str(), F_OK) != 0) {
+ if(!WrtUtilMakeDir(storagePath.str(), PRIVATE_STORAGE_MODE)){
+ LogError("Failed to create directory for private storage");
+ ThrowMsg(Exceptions::InternalError,
+ "Failed to create directory for private storage");
+ }
// '5000' is default uid, gid for applications.
// So installed applications should be launched as process of uid '5000'.
// the process can access private directory 'data' of itself.
ThrowMsg(Exceptions::InternalError,
"Chown to invaild user");
}
- } else if (access(storagePath.str().c_str(), W_OK | R_OK | X_OK) == 0) {
+ } else if (euidaccess(storagePath.str().c_str(), W_OK | R_OK | X_OK) == 0) {
LogInfo("Private storage already exists.");
// Even if private directory already is created, private dircetory
// should change owner.