From 9d34682323919037f9954cdfb2e8ba76eadc81be Mon Sep 17 00:00:00 2001 From: Hyunbin Lee Date: Fri, 26 Apr 2013 11:52:26 +0900 Subject: [PATCH] Support path beginning without / for OSP compatible application Change-Id: I0371269ef8dbc0e5b5d5b842e460bcd46a7aaafa Signed-off-by: Hyunbin Lee --- src/io/FIo_FileImpl.cpp | 10 ---------- src/io/FIo_FileUtil.cpp | 6 ++++-- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/io/FIo_FileImpl.cpp b/src/io/FIo_FileImpl.cpp index fa6a43d..091087f 100644 --- a/src/io/FIo_FileImpl.cpp +++ b/src/io/FIo_FileImpl.cpp @@ -567,22 +567,12 @@ _FileImpl::GetAttributes(const String& filePath, FileAttributes& attribute) String _FileImpl::GetFileName(const String& filePath) { - String fileName; - SysTryReturn(NID_IO, VerifyFilePathCompatibility(filePath, _AppInfo::IsOspCompat()) == true, fileName, E_INVALID_ARG, - "[E_INVALID_ARG] The length of the specified filePath (%ls) is zero or exceeds system limitations.", - filePath.GetPointer()); - return _FileUtil::GetFileName(filePath); } String _FileImpl::GetFileExtension(const String& filePath) { - String extName; - SysTryReturn(NID_IO, VerifyFilePathCompatibility(filePath, _AppInfo::IsOspCompat()) == true, extName, E_INVALID_ARG, - "[E_INVALID_ARG] The length of the specified filePath (%ls) is zero or exceeds system limitations.", - filePath.GetPointer()); - return _FileUtil::GetFileExtension(filePath); } diff --git a/src/io/FIo_FileUtil.cpp b/src/io/FIo_FileUtil.cpp index 974a1d0..6000996 100644 --- a/src/io/FIo_FileUtil.cpp +++ b/src/io/FIo_FileUtil.cpp @@ -373,7 +373,8 @@ _FileUtil::GetFileName(const String& filePath) int pos = -1; result r = filePath.LastIndexOf(L'/', filePath.GetLength() - 1, pos); - SysTryReturn(NID_IO, !IsFailed(r), fileName, E_INVALID_ARG, "[E_INVALID_ARG] The file path is invalid."); + SysTryReturn(NID_IO, r == E_SUCCESS || r == E_OBJ_NOT_FOUND, fileName, E_INVALID_ARG, + "[E_INVALID_ARG] The file path is invalid."); r = filePath.SubString(pos + 1, fileName); SysTryReturn(NID_IO, !IsFailed(r), fileName, E_INVALID_ARG, "[E_INVALID_ARG] The file path is invalid."); @@ -391,7 +392,8 @@ _FileUtil::GetFileExtension(const String& filePath) int pos = -1; result r = filePath.LastIndexOf(L'/', filePath.GetLength() - 1, pos); - SysTryReturn(NID_IO, !IsFailed(r), extName, E_INVALID_ARG, "[E_INVALID_ARG] The file path is invalid."); + SysTryReturn(NID_IO, r == E_SUCCESS || r == E_OBJ_NOT_FOUND, extName, E_INVALID_ARG, + "[E_INVALID_ARG] The file path is invalid."); String fileName; r = filePath.SubString(pos + 1, fileName); -- 2.7.4