if (hasResControl(pkgId)) {
std::string binPath = concatPath(rootPath, "bin");
- std::string resMountPath = concatPath(binPath, RES_MOUNT_SUB_DIR);
- if (exist(resMountPath)) {
- return 0;
- }
+ std::string resMount = concatPath(binPath, RES_MOUNT_SUB_DIR);
+ std::string resMountGadgetPath = concatPath(resMount, "gadget");
+ std::string resMountServicePath = concatPath(resMount, "service");
+ std::string resMountLibPath = concatPath(resMount, "lib");
+ std::vector<std::string> resMountPaths = {resMount, resMountGadgetPath, resMountServicePath, resMountLibPath};
// 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++) {
+ resMountPaths.erase(std::remove_if(resMountPaths.begin(), resMountPaths.end(), [](const std::string& path) {
+ return exist(path);
+ }), resMountPaths.end());
+
+ if (resMountPaths.size() == 0) {
+ return 0;
+ }
+
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;
+
+ for (auto &path : resMountPaths) {
+ if (exist(path) || createDir(path)) {
+ continue;
+ }
+ _INFO("Retry %d. Cannot create directory [%s]", i, path.c_str());
}
- _INFO("Retry %d. Cannot create directory [%s]", i, resMountPath.c_str());
}
}
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);
+ std::string resMount = concatPath(appBinPath, RES_MOUNT_SUB_DIR);
+ std::string resMountGadget = concatPath(resMount, "gadget");
+ std::string resMountService = concatPath(resMount, "service");
+ std::string resMountLib = concatPath(resMount, "lib");
+
+ appResMountPath = resMountGadget + ":" + resMountService + ":" + resMountLib;
appTacPath = concatPath(appBinPath, TAC_SYMLINK_SUB_DIR);
appPaths = appRootPath + ":" + appBinPath + ":" + appLibPath + ":" + appTacPath;
appNIPaths = appNIBinPath + ":" + appNILibPath + ":" + appTacPath;