Create private tmp directory in skel
[platform/core/appfw/app-installers.git] / src / common / shared_dirs.cc
index 499df1d..d1e1398 100644 (file)
@@ -134,7 +134,8 @@ bool SetDirectoryOwnerAndPermissions(const bf::path& subpath, uid_t uid,
 }
 
 bool CreateDirectories(const bf::path& app_dir, const std::string& pkgid,
-                       uid_t uid, gid_t gid, const bool set_permissions) {
+                       uid_t uid, gid_t gid, const bool set_permissions,
+                       const std::vector<const char*> additional_dirs = std::vector<const char*>()) {
   bf::path base_dir = app_dir / pkgid;
   if (bf::exists(base_dir)) {
     LOG(DEBUG) << "Directory for user already exist: " << base_dir;
@@ -143,6 +144,7 @@ bool CreateDirectories(const bf::path& app_dir, const std::string& pkgid,
 
   bs::error_code error;
   std::vector<const char*> dirs(kEntries);
+  dirs.insert(dirs.end(), additional_dirs.begin(), additional_dirs.end());
   // always trusted
   dirs.push_back(kSharedTrustedDir);
   for (auto& entry : dirs) {
@@ -430,7 +432,8 @@ bool PerformExternalDirectoryDeletionForAllUsers(const std::string& pkgid) {
 
 bool CreateSkelDirectories(const std::string& pkgid,
                            const std::string& api_version,
-                           bool trusted, bool shareddata, bool is_readonly) {
+                           bool trusted, bool shareddata, bool is_readonly,
+                           const std::vector<const char*> additional_dirs) {
   bf::path path = bf::path(kSkelAppDir) / pkgid;
   LOG(DEBUG) << "Creating directories in: " << path;
 
@@ -444,6 +447,7 @@ bool CreateSkelDirectories(const std::string& pkgid,
   }
 
   std::vector<const char*> dirs(kEntries);
+  dirs.insert(dirs.end(), additional_dirs.begin(), additional_dirs.end());
   if (trusted)
     dirs.push_back(kSharedTrustedDir);
   if (api_ver < ver30 || shareddata) {