Modify compatibility manager
[platform/framework/native/installer.git] / src / Util / InstallerUtil.cpp
index 96f2f6d..e07ee81 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>
@@ -236,7 +237,7 @@ InstallerUtil::GetRealPath(const String& filePath, String& realPath)
 }
 
 bool
-InstallerUtil::CreateSymlink(const String& oldPath, const String& newPath)
+InstallerUtil::CreateSymlink(const String& oldPath, const String& newPath, bool SmackLabelToRealPath)
 {
        int err = -1;
        bool res = false;
@@ -259,7 +260,15 @@ InstallerUtil::CreateSymlink(const String& oldPath, const String& newPath)
 
        SmackManager smackManager;
        String label("_");
-       smackManager.AddLabelDir(label, newPath);
+
+       if (SmackLabelToRealPath == true)
+       {
+               smackManager.AddLabelDir(label, newPath);
+       }
+       else
+       {
+               smackManager.AddLabelSymlink(label, newPath);
+       }
 
        AppLog("CreateSymlink(): [%ls] -> [%ls]", newPath.GetPointer(), oldPath.GetPointer());
 
@@ -1127,3 +1136,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;
+}