Skip to content

Commit f11075c

Browse files
author
전상현
committed
IsFileExist를 tstring으로 사용하도록 변경함
1 parent b8c189f commit f11075c

File tree

6 files changed

+11
-26
lines changed

6 files changed

+11
-26
lines changed

Src/100_System/FileSystem.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#define GetFileName GetFileNameW
1212
#define GetModuleFileName GetModuleFileNameW
1313
#define PathFileExists PathFileExistsW
14-
#define IsFileExist IsFileExistW
1514
#define IsDirectory IsDirectoryW
1615
#define CopyFile CopyFileW
1716
#define MoveFile MoveFileW
@@ -30,7 +29,6 @@
3029
#define GetFileName GetFileNameA
3130
#define GetModuleFileName GetModuleFileNameA
3231
#define PathFileExists PathFileExistsA
33-
#define IsFileExist IsFileExistA
3432
#define IsDirectory IsDirectoryA
3533
#define CopyFile CopyFileA
3634
#define MoveFile MoveFileA
@@ -54,8 +52,6 @@ namespace core
5452

5553
bool PathFileExistsA(const char* pszExistFile);
5654
bool PathFileExistsW(const wchar_t* pszExistFile);
57-
bool IsFileExistA(const char* pszExistFile);
58-
bool IsFileExistW(const wchar_t* pszExistFile);
5955
bool IsDirectoryA(const char* pszPath);
6056
bool IsDirectoryW(const wchar_t* pszPath);
6157

Src/100_System/FileSystemT_Linux_Mac.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ namespace core
5858
return (S_ISDIR(stStat.st_mode) || S_ISREG(stStat.st_mode));
5959
}
6060

61-
//////////////////////////////////////////////////////////////////////////
62-
bool IsFileExist(LPCTSTR pszExistFile)
63-
{
64-
struct stat stStat = { 0, };
65-
if( ::stat(MBSFromTCS(pszExistFile).c_str(), &stStat) < 0 )
66-
return false;
67-
68-
return (S_ISDIR(stStat.st_mode) || S_ISREG(stStat.st_mode));
69-
}
70-
7161
//////////////////////////////////////////////////////////////////////////
7262
bool IsDirectory(LPCTSTR pszPath)
7363
{

Src/100_System/FileSystemT_Win.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,6 @@ namespace core
6969
return ::PathFileExists(pszExistFile) != FALSE;
7070
}
7171

72-
//////////////////////////////////////////////////////////////////////////
73-
bool IsFileExist(LPCTSTR pszExistFile)
74-
{
75-
#ifdef UNICODE
76-
return 0 == ::_waccess(pszExistFile, 0);
77-
#else
78-
return 0 == ::_access(pszExistFile, 0);
79-
#endif
80-
}
81-
8272
//////////////////////////////////////////////////////////////////////////
8373
bool IsDirectory(LPCTSTR pszPath)
8474
{

Src/200_Common/Utility.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ namespace core
1919
ST_FUNC_CONSOLE_LOG(std::wstring strName);
2020
~ST_FUNC_CONSOLE_LOG(void);
2121
};
22+
23+
bool IsFileExist(std::string strFile);
24+
bool IsFileExist(std::wstring strFile);
2225

2326
char ReverseByteOrder(char btData);
2427
WORD ReverseByteOrder(WORD wData);

Src/200_Common/UtilityT.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ namespace core
2121
printf("---------- %s started ----------\n", m_strName.c_str());
2222
}
2323

24+
//////////////////////////////////////////////////////////////////////////
25+
bool IsFileExist(std::tstring strFile)
26+
{
27+
return PathFileExists(strFile.c_str());
28+
}
29+
2430
//////////////////////////////////////////////////////////////////////////
2531
template <typename T>
2632
static inline ECODE ReadFileContentsWorker(LPCTSTR pszFilePath, T& strContents, E_BOM_TYPE nEncodeType)

Src/200_Common/unzip.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3931,7 +3931,7 @@ ZRESULT TUnzip::Find(const TCHAR *tname,bool ic,int *index,ZIPENTRY *ze)
39313931
}
39323932

39333933
void EnsureDirectory(const TCHAR *rootdir, const TCHAR *dir)
3934-
{ if (rootdir!=0 && !IsFileExist(rootdir)) CreateDirectory(rootdir);
3934+
{ if (rootdir!=0 && !PathFileExists(rootdir)) CreateDirectory(rootdir);
39353935
if (*dir==0) return;
39363936
const TCHAR *lastslash=dir, *c=lastslash;
39373937
while (*c!=0) {if (*c=='/' || *c=='\\') lastslash=c; c++;}
@@ -3943,7 +3943,7 @@ void EnsureDirectory(const TCHAR *rootdir, const TCHAR *dir)
39433943
name++;
39443944
}
39453945
TCHAR cd[MAX_PATH]; *cd=0; if (rootdir!=0) SafeStrCpy(cd,MAX_PATH,rootdir); SafeStrCat(cd,MAX_PATH,dir);
3946-
if (!IsFileExist(cd)) CreateDirectory(cd);
3946+
if (!PathFileExists(cd)) CreateDirectory(cd);
39473947
}
39483948

39493949

0 commit comments

Comments
 (0)