From: j-h.choi Date: Thu, 24 Oct 2024 07:30:29 +0000 (+0900) Subject: Create the .res_mount directory X-Git-Tag: accepted/tizen/9.0/unified/20241121.045854~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=577a159730b3042e5e4d49336b4b8d59de2eed6b;p=platform%2Fcore%2Fdotnet%2Flauncher.git Create the .res_mount directory Change-Id: Id7bae9f77c41b5ff3d320a67a0de2fb277fca529 --- diff --git a/NativeLauncher/dotnet-launcher.info b/NativeLauncher/dotnet-launcher.info index 1fa1729..3b4cb46 100644 --- a/NativeLauncher/dotnet-launcher.info +++ b/NativeLauncher/dotnet-launcher.info @@ -1,6 +1,6 @@ -type="tag";name="ui-application";path="/etc/package-manager/parserlib/libdotnet_apptype_plugin.so" -type="tag";name="service-application";path="/etc/package-manager/parserlib/libdotnet_apptype_plugin.so" -type="tag";name="widget-application";path="/etc/package-manager/parserlib/libdotnet_apptype_plugin.so" -type="tag";name="watch-application";path="/etc/package-manager/parserlib/libdotnet_apptype_plugin.so" +type="tag";name="ui-application";path="/etc/package-manager/parserlib/libdotnet_apptype_plugin.so";vitalness="true" +type="tag";name="service-application";path="/etc/package-manager/parserlib/libdotnet_apptype_plugin.so";vitalness="true" +type="tag";name="widget-application";path="/etc/package-manager/parserlib/libdotnet_apptype_plugin.so";vitalness="true" +type="tag";name="watch-application";path="/etc/package-manager/parserlib/libdotnet_apptype_plugin.so";vitalness="true" type="metadata";name="http://tizen.org/metadata/prefer_nuget_cache";path="/etc/package-manager/parserlib/metadata/libprefer_nuget_cache_plugin.so" type="metadata";name="http://tizen.org/metadata/prefer_dotnet_aot";path="/etc/package-manager/parserlib/metadata/libprefer_dotnet_aot_plugin.so" diff --git a/NativeLauncher/inc/launcher_env.h b/NativeLauncher/inc/launcher_env.h index 6f38566..60b303c 100644 --- a/NativeLauncher/inc/launcher_env.h +++ b/NativeLauncher/inc/launcher_env.h @@ -26,6 +26,7 @@ #define APP_NI_SUB_DIR ".native_image" #define APP_NI_SUB_TMP_DIR ".native_image_tmp" #define TAC_SYMLINK_SUB_DIR ".tac_symlink" +#define RES_MOUNT_SUB_DIR ".res_mount" #define TAC_SHA_256_INFO ".SHA256.info" #define TAC_APP_LIST_DB ".TAC.App.list.db" #define TAC_APP_LIST_RESTORE_DB ".TAC.App.list.restore.db" diff --git a/NativeLauncher/inc/path_manager.h b/NativeLauncher/inc/path_manager.h index ab23578..b4e6f6f 100644 --- a/NativeLauncher/inc/path_manager.h +++ b/NativeLauncher/inc/path_manager.h @@ -114,6 +114,12 @@ public: */ const std::string& getAppRootPath(); + /** + * @brief Get the path of .res_mount of application + * @return .res_mount path + */ + const std::string& getAppResMountPath(); + /** * @brief Get the path of .tac_symlink of application * @return .tac_symlink path @@ -171,6 +177,7 @@ private: std::string appNIPaths; std::string appCLRPaths; std::string nativeDllSearchingPaths; + std::string appResMountPath; std::string appTacPath; std::string extraDllPaths; int rootFD; diff --git a/NativeLauncher/installer-plugin/dotnet_apptype_plugin.cc b/NativeLauncher/installer-plugin/dotnet_apptype_plugin.cc index 973a806..e10ebbd 100644 --- a/NativeLauncher/installer-plugin/dotnet_apptype_plugin.cc +++ b/NativeLauncher/installer-plugin/dotnet_apptype_plugin.cc @@ -71,6 +71,27 @@ extern "C" int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr doc, const char* pkgId) checkInternetPrivilegeAndDisableIPv6(pkgId, rootPath); + if (hasResControl(pkgId)) { + std::string binPath = concatPath(rootPath, "bin"); + std::string resMountPath = concatPath(binPath, RES_MOUNT_SUB_DIR); + if (exist(resMountPath)) { + return 0; + } + + // Create a .res_mount folder 3 times to prevent malfunctions in app execution. + // If folder creation still fails, the app installation is processed to fail. + for (int i = 1; i <= 4; i++) { + if (i == 4) { + _ERR("The .res_mount folder could not be created despite 3 attempts. Stop installing the [%s]", pkgId); + return -1; + } + if (createDir(resMountPath)) { + return 0; + } + _INFO("Retry %d. Cannot create directory [%s]", i, resMountPath.c_str()); + } + } + return 0; } extern "C" int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr doc, const char* pkgId) diff --git a/NativeLauncher/util/path_manager.cc b/NativeLauncher/util/path_manager.cc index 2d1f41c..9d97100 100644 --- a/NativeLauncher/util/path_manager.cc +++ b/NativeLauncher/util/path_manager.cc @@ -62,10 +62,11 @@ void PathManager::updateAppRelatedPath(const std::string& appRootPath, const std std::string appNIBinPath = concatPath(concatPath(appNIRootPath, "bin"), APP_NI_SUB_DIR); std::string appNILibPath = concatPath(concatPath(appNIRootPath, "lib"), APP_NI_SUB_DIR); + appResMountPath = concatPath(appBinPath, RES_MOUNT_SUB_DIR); appTacPath = concatPath(appBinPath, TAC_SYMLINK_SUB_DIR); appPaths = appRootPath + ":" + appBinPath + ":" + appLibPath + ":" + appTacPath; appNIPaths = appNIBinPath + ":" + appNILibPath + ":" + appTacPath; - appCLRPaths = appNIPaths + ":" + appPaths; + appCLRPaths = appResMountPath + ":" + appNIPaths + ":" + appPaths; if (!extraDllPaths.empty()) { appPaths = appPaths + ":" + extraDllPaths; @@ -115,7 +116,7 @@ PathManager::PathManager() : updateAppRelatedPath(appRootPath, appNIRootPath); // Set native library searching path - nativeDllSearchingPaths = runtimePath + ":" + __NATIVE_LIB_DIR + ":" + + nativeDllSearchingPaths = runtimePath + ":" + __NATIVE_LIB_DIR + ":" + concatPath(appRootPath, RES_MOUNT_SUB_DIR) + ":" + concatPath(appRootPath, "bin") + ":" + concatPath(appRootPath, "lib") + ":" + getExtraNativeLibDirs(appRootPath); @@ -238,6 +239,12 @@ const std::string& PathManager::getAppNIPaths() return appNIPaths; } +// return res mount path +const std::string& PathManager::getAppResMountPath() +{ + return appResMountPath; +} + // return ni dll and dll searching paths for app const std::string& PathManager::getAppCLRPaths() {