Add OSP compatibility.
authorHyunbin Lee <hyunbin.lee@samsung.com>
Tue, 8 Jan 2013 12:12:59 +0000 (21:12 +0900)
committerHyunbin Lee <hyunbin.lee@samsung.com>
Wed, 9 Jan 2013 01:48:29 +0000 (10:48 +0900)
Change-Id: I72ad6cd94afd35d8f88bc27beb2f83233296608a
Signed-off-by: Hyunbin Lee <hyunbin.lee@samsung.com>
src/Manager/PermissionManager.cpp
src/Step/UninstallStep.cpp

index 2fefcd1..3311a40 100755 (executable)
@@ -139,9 +139,9 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
        AppLogTag(OSP_INSTALLER, "[Tizen::Io] # appId = [%ls]", appId.GetPointer());
        AppLogTag(OSP_INSTALLER, "[Tizen::Io] # apiVersion = [%ls]", apiVersion.GetPointer());
 
-       if (apiVersion.CompareTo(L"2.0") == 0)
+       if (pContext->__isOspCompat == true)
        {
-               AppLogTag(OSP_INSTALLER, "[Tizen::Io] apiVersion is 2.0");
+               AppLogTag(OSP_INSTALLER, "[Tizen::Io] OSP 2.0 application");
 
                if (_FileImpl::PrepareDataCaging(appRootPath, appId) == false)
                {
@@ -153,7 +153,7 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
        }
        else
        {
-               AppLogTag(OSP_INSTALLER, "[Tizen::Io] apiVersion is equal to or greater than 2.1");
+               AppLogTag(OSP_INSTALLER, "[Tizen::Io] apiVersion is equal to or greater than Tizen 2.0");
 
                if (_FileImpl::CreateOspApplicationDirectories(appRootPath, appId) == false)
                {
index 75bb455..7dd1f9d 100755 (executable)
@@ -215,30 +215,24 @@ UninstallStep::OnStateRemoveDir(void)
        rootPath = pPackageInfoImpl->GetAppRootPath();
        AppLogTag(OSP_INSTALLER, "rootPath[%ls]", rootPath.GetPointer());
 
-       String versionFile(rootPath);
-       versionFile.Append(L"/info/version.info");
-
-       File file;
-       result r = file.Construct(versionFile, "r");
-       TryReturn(r == E_SUCCESS || r == E_FILE_NOT_FOUND, INSTALLER_ERROR_UNMOUNT_FAILED, "Failed to open version.info");
-       if (r == E_SUCCESS)
+       String compatPath(rootPath);
+       compatPath.Append(L"/info/compat.info");
+       bool ospCompat = File::IsFileExist(compatPath);
+       result r = GetLastResult();
+       if (r == E_SUCCESS && ospCompat == true)
        {
-               //String apiVersion = pPackageInfoImpl->GetAppApiVersion();
-               //if (pPackageInfoImpl->GetAppApiVersion() == L"2.0")
-               String version;
-               r = file.Read(version);
-               TryReturn(r == E_SUCCESS, INSTALLER_ERROR_UNMOUNT_FAILED, "Failed to read version.info");
-
-               if (version.Contains(L"2.0"))
+               if (_FileImpl::FinalizeDataCaging(rootPath) == false)
                {
-                       if (_FileImpl::FinalizeDataCaging(rootPath) == false)
-                       {
-                               AppLogTag(OSP_INSTALLER, "Failed to unmount directories for 2.0 application, appRootPath: %ls",
-                                               rootPath.GetPointer());
-                               return INSTALLER_ERROR_UNMOUNT_FAILED;
-                       }
+                       AppLogTag(OSP_INSTALLER, "[Tizen::Io] Failed to unmount directories for 2.0 application, appRootPath: %ls",
+                                       rootPath.GetPointer());
+                       return INSTALLER_ERROR_UNMOUNT_FAILED;
                }
        }
+       else if (r != E_SUCCESS)
+       {
+               AppLogTag(OSP_INSTALLER, "[Tizen::Io] Failed to access %ls", compatPath.GetPointer());
+               return INSTALLER_ERROR_UNMOUNT_FAILED;
+       }
 
        AppLogTag(OSP_INSTALLER, "Directory::Remove - START");