Fix creating trusted dir 41/61041/3
authorSangyoon Jang <s89.jang@samsung.com>
Thu, 3 Mar 2016 12:19:11 +0000 (21:19 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Mon, 7 Mar 2016 04:42:10 +0000 (20:42 -0800)
Make it more clearly.

Change-Id: I07f05550a144e2a7a307db0dbad32d071383d861
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
src/pkgdir_tool/pkgdir_tool.cc

index 7a8013e..ffd8d7a 100644 (file)
@@ -46,9 +46,9 @@ const std::vector<const char*> kEntries = {
   {"data/"},
   {"shared/"},
   {"shared/cache/"},
-  {"shared/trusted/"}
 };
 
+const char kTrustedDir[] = "shared/trusted";
 const char kSkelAppDir[] = "/etc/skel/apps_rw";
 const char kPackagePattern[] = R"(^[0-9a-zA-Z_-]+(\.?[0-9a-zA-Z_-]+)*$)";
 
@@ -190,8 +190,9 @@ bool CreateDirectories(const bf::path& app_dir, const std::string& pkgid,
   }
 
   bs::error_code error;
-  std::vector<const char*> dirs(
-      kEntries.begin(), kEntries.end() - (author_id.empty() ? 1 : 0));
+  std::vector<const char*> dirs(kEntries);
+  if (!author_id.empty())
+    dirs.push_back(kTrustedDir);
   for (auto& entry : dirs) {
     bf::path subpath = base_dir / entry;
     bf::create_directories(subpath, error);