Introduce Dedicated Helper to Call stat()
This commit is contained in:
parent
38e38546a4
commit
b11bea56a5
@ -99,6 +99,17 @@ int g_utilDisplayLevel;
|
|||||||
* Functions
|
* Functions
|
||||||
***************************************/
|
***************************************/
|
||||||
|
|
||||||
|
int UTIL_stat(const char* filename, stat_t* statbuf)
|
||||||
|
{
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
return !_stat64(filename, statbuf);
|
||||||
|
#elif defined(__MINGW32__) && defined (__MSVCRT__)
|
||||||
|
return !_stati64(filename, statbuf);
|
||||||
|
#else
|
||||||
|
return !stat(filename, statbuf);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int UTIL_fileExist(const char* filename)
|
int UTIL_fileExist(const char* filename)
|
||||||
{
|
{
|
||||||
stat_t statbuf;
|
stat_t statbuf;
|
||||||
|
@ -100,6 +100,8 @@ extern int g_utilDisplayLevel;
|
|||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
typedef struct __stat64 stat_t;
|
typedef struct __stat64 stat_t;
|
||||||
typedef int mode_t;
|
typedef int mode_t;
|
||||||
|
#elif defined(__MINGW32__) && defined (__MSVCRT__)
|
||||||
|
typedef struct _stati64 stat_t;
|
||||||
#else
|
#else
|
||||||
typedef struct stat stat_t;
|
typedef struct stat stat_t;
|
||||||
#endif
|
#endif
|
||||||
@ -113,6 +115,11 @@ extern int g_utilDisplayLevel;
|
|||||||
#define STRDUP(s) strdup(s)
|
#define STRDUP(s) strdup(s)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls platform's equivalent of stat() on filename and writes info to statbuf.
|
||||||
|
* Returns success (1) or failure (0).
|
||||||
|
*/
|
||||||
|
int UTIL_stat(const char* filename, stat_t* statbuf);
|
||||||
int UTIL_fileExist(const char* filename);
|
int UTIL_fileExist(const char* filename);
|
||||||
int UTIL_isRegularFile(const char* infilename);
|
int UTIL_isRegularFile(const char* infilename);
|
||||||
int UTIL_isDirectory(const char* infilename);
|
int UTIL_isDirectory(const char* infilename);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user