diff --git a/src/appspawn_server.cpp b/src/appspawn_server.cpp index b4ef590d359acad7d84ccaf87a6bb3bb78a22e58..a19648c7358172e422e7b5d3bd2cb07e89e7d137 100644 --- a/src/appspawn_server.cpp +++ b/src/appspawn_server.cpp @@ -453,12 +453,13 @@ int32_t AppSpawnServer::DoAppSandboxMountOnce(const std::string originPath, cons int32_t AppSpawnServer::DoAppSandboxMount(const ClientSocket::AppProperty *appProperty, std::string rootPath) { + std::string currentUserId = std::to_string(appProperty->uid / 200000); std::string oriInstallPath = "/data/app/el1/bundle/"; - std::string oriDataPath = "/data/app/el2/0/base/"; - std::string oriDatabasePath = "/data/app/el2/0/database/"; + std::string oriDataPath = "/data/app/el2/" + currentUserId + "/base/"; + std::string oriDatabasePath = "/data/app/el2/" + currentUserId + "/database/"; std::string destAPI7InstallPath = rootPath + "/data/accounts/account_0/applications"; std::string destDatabasePath = rootPath + "/data/storage/el2/database"; - std::string destInstallPath = rootPath + "/data/storage/el1/0/bundle"; + std::string destInstallPath = rootPath + "/data/storage/el1/bundle"; std::string destDataPath = rootPath + "/data/storage/el2/base"; int rc = 0; @@ -481,6 +482,18 @@ int32_t AppSpawnServer::DoAppSandboxMount(const ClientSocket::AppProperty *appPr } } + // Add distributedfile module support, later reconstruct it + std::string oriDistributedPath = "/mnt/hmdfs/" + currentUserId + "/merge_view/data/" + bundleName; + std::string destDistributedPath = rootPath + "/data/storage/el2/distributedfiles"; + DoAppSandboxMountOnce(oriDistributedPath.c_str(), destDistributedPath.c_str()); + + std::string oriDistributedGroupPath = "/mnt/hmdfs/auth_groups/" + currentUserId + "/merge_view/data/" + bundleName; + std::string destDistributedGroupPath = rootPath + "/data/storage/el2/accountless_distributedfile"; + DoAppSandboxMountOnce(oriDistributedGroupPath.c_str(), destDistributedGroupPath.c_str()); + + std::string oriMediaPath = "/storage/media/" + currentUserId; + std::string destMediaPath = rootPath + "/storage/media"; + DoAppSandboxMountOnce(oriMediaPath.c_str(), destMediaPath.c_str()); return 0; } @@ -494,9 +507,9 @@ void AppSpawnServer::DoAppSandboxMkdir(std::string sandboxPackagePath, const Cli mkdir(dirPath.c_str(), FILE_MODE); dirPath = sandboxPackagePath + "/data/storage/el1"; mkdir(dirPath.c_str(), FILE_MODE); - dirPath = sandboxPackagePath + "/data/storage/el1/0"; + dirPath = sandboxPackagePath + "/data/storage/el1"; mkdir(dirPath.c_str(), FILE_MODE); - dirPath = sandboxPackagePath + "/data/storage/el1/0/bundle"; + dirPath = sandboxPackagePath + "/data/storage/el1/bundle"; mkdir(dirPath.c_str(), FILE_MODE); // to create /mnt/sandbox//data/storage/el1 related path, later should delete this code. @@ -507,6 +520,10 @@ void AppSpawnServer::DoAppSandboxMkdir(std::string sandboxPackagePath, const Cli mkdir(dirPath.c_str(), FILE_MODE); dirPath = sandboxPackagePath + "/data/storage/el2/database"; mkdir(dirPath.c_str(), FILE_MODE); + dirPath = sandboxPackagePath + "/data/storage/el2/distributedfiles"; + mkdir(dirPath.c_str(), FILE_MODE); + dirPath = sandboxPackagePath + "/data/storage/el2/accountless_distributedfile"; + mkdir(dirPath.c_str(), FILE_MODE); } int32_t AppSpawnServer::SetAppSandboxProperty(const ClientSocket::AppProperty *appProperty)