LogDebug("Create resource directory");
WrtUtilMakeDir(widgetBinPath);
WrtUtilMakeDir(widgetSrcPath);
+ if (m_context.job->getInstallerStruct().m_installMode
+ == InstallMode::INSTALL_MODE_PRELOAD)
+ {
+ std::string userWidgetDir = m_context.locations->getUserDataRootDir();
+ WrtUtilMakeDir(userWidgetDir);
+ }
}
m_context.job->UpdateProgress(
WrtDB::GlobalConfig::GetWidgetSrcPath();
if (0 != access(srcDir.c_str(), F_OK)) {
- LogDebug("Make symbolic name for preaload app" << " to " << srcDir <<
- "from " << m_context.locations->getSourceDir());
+ LogDebug("Make symbolic name for preaload app" <<
+ m_context.locations->getSourceDir() << " to " << srcDir);
std::string resDir = m_context.locations->getUserDataRootDir() +
"/res";
std::string storagePath = m_context.locations->getPrivateStorageDir();
std::string dataDir = m_context.locations->getPackageInstallationDir() +
"/" + WrtDB::GlobalConfig::GetWidgetPrivateStoragePath();
+ if (0 != access(dataDir.c_str(), F_OK)) {
+ LogDebug("Make symbolic name for preaload app " <<
+ storagePath << " to " << dataDir);
+
+ if (symlink(storagePath.c_str(), dataDir.c_str()) != 0)
+ {
+ int error = errno;
+ if (error)
+ LogPedantic("Failed to make a symbolic name for a file "
+ << "[" << DPL::GetErrnoString(error) << "]");
+ ThrowMsg(Exceptions::FileOperationFailed,
+ "Symbolic link creating is not done.");
+ }
+ changeOwnerForDirectory(dataDir);
+ }
+
+ if (m_context.widgetConfig.packagingType != PKG_TYPE_HYBRID_WEB_APP) {
+ std::string widgetBinPath = m_context.locations->getBinaryDir();
+ std::string userBinPath = m_context.locations->getUserBinaryDir();
+ LogDebug("Make symbolic link for preload app " << widgetBinPath <<
+ " to " << userBinPath);
+ if (symlink(widgetBinPath.c_str(), userBinPath.c_str()) != 0)
+ {
+ int error = errno;
+ if (error)
+ LogPedantic("Failed to make a symbolic name for a file "
+ << "[" << DPL::GetErrnoString(error) << "]");
+ ThrowMsg(Exceptions::FileOperationFailed,
+ "Symbolic link creating is not done.");
+ }
- if (symlink(storagePath.c_str(), dataDir.c_str()) != 0)
- {
- int error = errno;
- if (error)
- LogPedantic("Failed to make a symbolic name for a file "
- << "[" << DPL::GetErrnoString(error) << "]");
- ThrowMsg(Exceptions::FileOperationFailed,
- "Symbolic link creating is not done.");
}
- changeOwnerForDirectory(dataDir);
}
}
ThrowMsg(Exceptions::RemovingFolderFailure,
"Error occurs during removing existing folder");
}
+ // Remove user data directory if preload web app.
+ std::string userData = m_context.locations->getUserDataRootDir();
+ if (0 == access(userData.c_str(), F_OK)) {
+ WrtUtilRemove(userData);
+ }
+
}
LogDebug("Rename widget path sucessful!");
}