Introduce Dedicated Helper to Call stat()
This commit is contained in:
parent
38e38546a4
commit
b11bea56a5
@ -99,6 +99,17 @@ int g_utilDisplayLevel;
|
||||
* 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)
|
||||
{
|
||||
stat_t statbuf;
|
||||
|
@ -100,6 +100,8 @@ extern int g_utilDisplayLevel;
|
||||
#if defined(_MSC_VER)
|
||||
typedef struct __stat64 stat_t;
|
||||
typedef int mode_t;
|
||||
#elif defined(__MINGW32__) && defined (__MSVCRT__)
|
||||
typedef struct _stati64 stat_t;
|
||||
#else
|
||||
typedef struct stat stat_t;
|
||||
#endif
|
||||
@ -113,6 +115,11 @@ extern int g_utilDisplayLevel;
|
||||
#define STRDUP(s) strdup(s)
|
||||
#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_isRegularFile(const char* infilename);
|
||||
int UTIL_isDirectory(const char* infilename);
|
||||
|
Loading…
Reference in New Issue
Block a user