checking 'apps' existence of external storage. 36/72736/1 accepted/tizen/common/20160606.141604 accepted/tizen/ivi/20160602.230743 accepted/tizen/mobile/20160602.230724 accepted/tizen/tv/20160602.230706 accepted/tizen/wearable/20160602.230641 submit/tizen/20160602.040935
authorjongmyeongko <jongmyeong.ko@samsung.com>
Thu, 2 Jun 2016 08:11:51 +0000 (17:11 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Thu, 2 Jun 2016 08:52:56 +0000 (17:52 +0900)
Change-Id: I613723e71183177aaaeebb9b94afb06858ea6880
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/common/shared_dirs.cc

index ef1dd10..01c4094 100644 (file)
@@ -61,7 +61,7 @@ const std::vector<const char*> kEntries = {
 const char kTrustedDir[] = "shared/trusted";
 const char kSkelAppDir[] = "/etc/skel/apps_rw";
 const char kPackagePattern[] = R"(^[0-9a-zA-Z_-]+(\.?[0-9a-zA-Z_-]+)*$)";
-const char kExternalStorageDirPrefix[] = "SDCardA1/apps";
+const char kExternalStorageDirPrefix[] = "SDCardA1";
 const char kDBusServiceName[] = "org.tizen.pkgdir_tool";
 const char kDBusObjectPath[] = "/org/tizen/pkgdir_tool";
 const char kDBusInterfaceName[] = "org.tizen.pkgdir_tool";
@@ -370,8 +370,19 @@ bool PerformExternalDirectoryCreationForUser(uid_t user,
     return false;
   }
 
+  bf::path storage_apps_path = bf::path(storage_path) / "apps";
+  if (!bf::exists(storage_apps_path)) {
+    bs::error_code error;
+    bf::create_directories(storage_apps_path, error);
+    if (error) {
+      LOG(ERROR) << "Failed to create directory: "
+          << storage_apps_path.c_str();
+      return false;
+    }
+  }
+
   if (CreateUserDirectories(user, pkgid, author_id,
-                            storage_path, set_permissions)) {
+                            storage_apps_path.c_str(), set_permissions)) {
   }
   return true;
 }