From edc49547a21308fb604049c0103ee952b233336c Mon Sep 17 00:00:00 2001 From: Hyunbin Lee Date: Fri, 12 Apr 2013 11:26:54 +0900 Subject: [PATCH] Remove all sub-files deliveried in shared/data and shared/trusted directory for OSP compatible application. Change-Id: I015ed586fffe2da1fb74082513d947d4e29f9843 Signed-off-by: Hyunbin Lee --- src/io/FIo_FileImpl.cpp | 20 ++++++++++++-------- src/io/inc/FIo_FileImpl.h | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) 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); -- 2.7.4