From: Hyunbin Lee Date: Fri, 12 Apr 2013 02:26:54 +0000 (+0900) Subject: Remove all sub-files deliveried in shared/data and shared/trusted directory for OSP... X-Git-Tag: accepted/tizen_2.1/20130425.034849~83 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=edc49547a21308fb604049c0103ee952b233336c;p=platform%2Fframework%2Fnative%2Fappfw.git Remove all sub-files deliveried in shared/data and shared/trusted directory for OSP compatible application. Change-Id: I015ed586fffe2da1fb74082513d947d4e29f9843 Signed-off-by: Hyunbin Lee --- diff --git a/src/io/FIo_FileImpl.cpp b/src/io/FIo_FileImpl.cpp index 5837696..ce3749f 100644 --- a/src/io/FIo_FileImpl.cpp +++ b/src/io/FIo_FileImpl.cpp @@ -717,7 +717,7 @@ _FileImpl::PrepareDataCaging(const String& appRootPath, const String& pkgId) SysTryCatch(NID_IO, chdir(pAppRootPath.get()) == 0, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] chdir() was failed (%s), path: %s", strerror(errno), pAppRootPath.get()); - SysTryCatch(NID_IO, CreateOspInternalDirectories(pkgId) == true, r = E_SYSTEM, E_SYSTEM, + SysTryCatch(NID_IO, CreateOspInternalDirectories(appRootPath, pkgId) == true, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] fail to create OSP Internal directories"); } else @@ -935,7 +935,7 @@ CATCH: } bool -_FileImpl::CreateOspInternalDirectories(const String& pkgId) // for 2.0 app +_FileImpl::CreateOspInternalDirectories(const String& appRootPath, const String& pkgId) // for 2.0 app { unsigned int i = 0; int ret = 0; @@ -1073,12 +1073,16 @@ _FileImpl::CreateOspInternalDirectories(const String& pkgId) // for 2.0 app SysTryReturn(NID_IO, system(chownCmd) != -1, false, E_SYSTEM, "[E_SYSTEM] chown() failed"); } #endif - ret = remove("./shared/data"); - SysTryReturn(NID_IO, ret == 0 || errno == ENOENT, false, E_SYSTEM, - "[E_SYSTEM] remove() failed, errno: %d (%s), path: ./shared/data", errno, strerror(errno)); - ret = remove("./shared/trusted"); - SysTryReturn(NID_IO, ret == 0 || errno == ENOENT, false, E_SYSTEM, - "[E_SYSTEM] remove() failed, errno: %d (%s), path: ./shared/trusted", errno, strerror(errno)); + String appSharedDataPath(appRootPath); + appSharedDataPath.Append(L"/shared/data"); + + String appSharedTrustedPath(appRootPath); + appSharedTrustedPath.Append(L"/shared/trusted"); + + SysTryReturn(NID_IO, Directory::Remove(appSharedDataPath, true) == E_SUCCESS, false, E_SYSTEM, + "[E_SYSTEM] Failed to remove path (%ls)", appSharedDataPath.GetPointer()); + SysTryReturn(NID_IO, Directory::Remove(appSharedTrustedPath, true) == E_SUCCESS, false, E_SYSTEM, + "[E_SYSTEM] Failed to remove path (%ls)", appSharedTrustedPath.GetPointer()); ret = symlink(pOspShareAppIdPath.get(), "./shared/data"); SysTryReturn(NID_IO, ret == 0, false, E_SYSTEM, diff --git a/src/io/inc/FIo_FileImpl.h b/src/io/inc/FIo_FileImpl.h index 6ed64c7..b1cacd4 100644 --- a/src/io/inc/FIo_FileImpl.h +++ b/src/io/inc/FIo_FileImpl.h @@ -205,7 +205,7 @@ private: static bool VerifyFilePath(const Tizen::Base::String& filePath, _FilePathType pathType); - static bool CreateOspInternalDirectories(const Tizen::Base::String& pkgId); + static bool CreateOspInternalDirectories(const Tizen::Base::String& appRootPath, const Tizen::Base::String& pkgId); static bool CreateOspExternalDirectories(const Tizen::Base::String& pkgId);