Update installation storage for sdcard
[platform/framework/native/installer.git] / src / Util / InstallerUtil.cpp
index 96f2f6d..7be47c6 100755 (executable)
@@ -25,6 +25,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <unique_ptr.h>
+#include <vconf.h>
 
 #include <FBaseErrorDefine.h>
 #include <FIoFile.h>
@@ -1127,3 +1128,34 @@ InstallerUtil::IsCscPackage(const PackageId& packageId, String& cscInfo)
 
        return res;
 }
+
+bool
+InstallerUtil::IsDefaultExternalStorage()
+{
+       int res = 0;
+       int storage = 0;
+       int mmcStatus = VCONFKEY_SYSMAN_MMC_REMOVED;
+
+       res = vconf_get_int("db/setting/default_memory/download", &storage);
+       TryReturn(res == 0, false, "vconf_get_int(db/setting/default_memory/download) failed.");
+
+       AppLog("Storage = [%d]", storage);
+
+       if (storage == 1)
+       {
+               res = vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &mmcStatus);
+               TryReturn(res == 0, false, "vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS) failed.");
+
+               if ((mmcStatus == VCONFKEY_SYSMAN_MMC_REMOVED) || (mmcStatus == VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED))
+               {
+                       AppLog("mmcStatus is MMC_REMOVED or NOT_MOUNTED.");
+               }
+               else
+               {
+                       AppLog("mmcStatus is MMC_MOUNTED.");
+                       return true;
+               }
+       }
+
+       return false;
+}