diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2010-07-15 03:39:23 +0400 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2010-07-15 03:39:23 +0400 |
commit | 0980f2555f565bfac0958483da76b7e75e8921e5 (patch) | |
tree | a9aae0fb12eec4073ab093bff53f3b526b5f9969 /source/blender/blenlib/intern/storage.c | |
parent | aa15c8a5bfdb11bccd9927f9bb77808d55c4356e (diff) |
* Use same BLI_exist() on all platforms.
* remove extra sys/types.h include.
Diffstat (limited to 'source/blender/blenlib/intern/storage.c')
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 51d5f0354f9..3315e9645d4 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -76,7 +76,6 @@ #endif #ifdef WIN32 -#include <sys/types.h> #include <io.h> #include <direct.h> #include "BLI_winstuff.h" @@ -433,18 +432,20 @@ int BLI_filepathsize(const char *path) int BLI_exist(char *name) { - struct stat st; #ifdef WIN32 + struct _stat64i32 st; /* in Windows stat doesn't recognize dir ending on a slash To not break code where the ending slash is expected we don't mess with the argument name directly here - elubie */ char tmp[FILE_MAXDIR+FILE_MAXFILE]; - int len; + int len, res; BLI_strncpy(tmp, name, FILE_MAXDIR+FILE_MAXFILE); len = strlen(tmp); if (len > 3 && ( tmp[len-1]=='\\' || tmp[len-1]=='/') ) tmp[len-1] = '\0'; - if (stat(tmp,&st)) return(0); + res = _stat(tmp, &st); + if (res == -1) return(0); #else + struct stat st; if (stat(name,&st)) return(0); #endif return(st.st_mode); |