Fix appsetting filter issue, Add store_clientId in xml
authorDuyoung Jang <duyoung.jang@samsung.com>
Wed, 17 Apr 2013 10:21:29 +0000 (19:21 +0900)
committerDuyoung Jang <duyoung.jang@samsung.com>
Wed, 17 Apr 2013 10:21:29 +0000 (19:21 +0900)
Change-Id: Ic0d1ca17ec622f9502ceb356d7a3a4a6108a7bdb
Signed-off-by: Duyoung Jang <duyoung.jang@samsung.com>
inc/InstallerDefs.h
src/Manager/PermissionManager.cpp
src/Manager/SmackManager.cpp
src/XmlHandler/ManifestGenerator.cpp
src/backend/backend.cpp

index 8c9a6ac..dd40ad0 100755 (executable)
@@ -23,7 +23,7 @@
 
 #include "InstallerUtil.h"
 
-#define OSP_INSTALLER_VERSION "version=[20130417.2]"
+#define OSP_INSTALLER_VERSION "version=[20130417.3]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
index 91d7e3e..66ba2de 100755 (executable)
@@ -123,7 +123,7 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
 
        // appRoot/setting
        destPath = appRootPath + DIR_SETTING;
-       if (pContext->__isAppSetting == true)
+       if (File::IsFileExist(destPath) == true)
        {
                String appVersion = pContext->__version;
                String srcPath;
index f627e67..00ea2a5 100755 (executable)
 #include <dlfcn.h>
 #include <unique_ptr.h>
 
+#include <FAppPkgPackageInfo.h>
 #include <FIoFile.h>
 #include <FIoRegistry.h>
 #include <FSecCryptoSha1Hash.h>
+#include <FAppPkg_PackageManagerImpl.h>
 #include <FBase_StringConverter.h>
 
 #include "SmackManager.h"
@@ -32,6 +34,7 @@
 #include "InstallerUtil.h"
 
 using namespace Tizen::App;
+using namespace Tizen::App::Package;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Utility;
@@ -170,13 +173,14 @@ SmackManager::AddLabelSharedDir(const PackageId& packageId, const String& dirPat
 
        if (dirPath.Contains(L"shared/data") == true)
        {
-               label = L"*";
-               //label.Append("_shareddata");
+               label.Append("_shareddata");
+               AddSharedDirReaders(label);
+
+               return true;
        }
        else if (dirPath.Contains(L"shared/res") == true)
        {
                label = L"_";
-               //label.Append("_sharedres");
        }
        else if (dirPath.Contains(L"shared/trusted") == true)
        {
@@ -233,7 +237,45 @@ SmackManager::AddSharedDirReaders(const Tizen::Base::String& label)
                return true;
        }
 
-       //int AddSharedDirReaders(const char* pSharedLabel, const char** ppAppList);
+       TryReturn(__pContext, false, "__pContext is null");
+
+       int res = 0;
+
+       std::unique_ptr<char[]> pLabel(_StringConverter::CopyToCharArrayN(label));
+       TryReturn(pLabel, false, "pLabel is null.");
+
+       std::unique_ptr< IList > pPackageList(_PackageManagerImpl::GetInstance()->GetPackageInfoListN());
+       TryReturn(pPackageList, false, "pPackageList is null.");
+
+       int count = pPackageList->GetCount();
+
+       const char** pList = new (std::nothrow) const char*[count+1];
+       TryReturn(pList, false, "pList is null.");
+
+       for (int i = 0; i < count; i++)
+       {
+               PackageInfo* pPackageInfo = dynamic_cast < PackageInfo* >(pPackageList->GetAt(i));
+               if (pPackageInfo)
+               {
+                       PackageId packageId = pPackageInfo->GetId();
+
+                       char* pPackageId = _StringConverter::CopyToCharArrayN(packageId);
+                       TryReturn(pPackageId, false, "pPackageId is null.");
+
+                       pList[i] = pPackageId;
+               }
+        }
+
+       pList[count] = null;
+
+       res = AddSharedDirReaders(pLabel.get(), pList);
+
+       for (int i = 0; pList[i] != null; i++)
+       {
+               //AppLog("delete PackageId - [%s]", pList[i]);
+               delete[] pList[i];
+        }
+       delete[] pList;
 
        return true;
 }
index 4eda37a..39a8faa 100755 (executable)
@@ -73,8 +73,8 @@ ManifestGenerator::Write()
                location = L"auto";
        }
 
-       String appSettingPath = __pContext->__rootPath + DIR_SETTING;
-       if (File::IsFileExist(appSettingPath) == true)
+       String appSettingXmlPath = __pContext->__rootPath + DIR_SETTING + L"/setting." + __pContext->__version +  L".xml";
+       if (File::IsFileExist(appSettingXmlPath) == true)
        {
                __pContext->__isAppSetting = true;
                appSetting = L"true";
@@ -90,6 +90,7 @@ ManifestGenerator::Write()
        __pWriter->WriteAttribute("install-location", location);
        __pWriter->WriteAttribute("root_path", __pContext->__rootPath);
        __pWriter->WriteAttribute("appsetting", appSetting);
+       __pWriter->WriteAttribute("storeclient-id", __pContext->__storeClientId);
 
        __pWriter->StartElement("label");
        __pWriter->WriteString(__pContext->__displayName);
index c9c71a6..b67284c 100755 (executable)
@@ -62,14 +62,17 @@ main(int argc, char **argv)
        String buf;
        for (int i = 0; i < argc; i++)
        {
-               const char* pStr = argv[i];
-               if (pStr)
+               if (strlen(argv[i]) < 1024)
                {
-                       String cmd(pStr);
-                       buf.Append(cmd);
-                       if (i != argc - 1)
+                       const char* pStr = argv[i];
+                       if (pStr)
                        {
-                               buf.Append(" ");
+                               String cmd(pStr);
+                               buf.Append(cmd);
+                               if (i != argc - 1)
+                               {
+                                       buf.Append(" ");
+                               }
                        }
                }
        }