Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorNathan Letwory <nathan@letworyinteractive.com>2010-07-15 03:39:23 +0400
committerNathan Letwory <nathan@letworyinteractive.com>2010-07-15 03:39:23 +0400
commit0980f2555f565bfac0958483da76b7e75e8921e5 (patch)
treea9aae0fb12eec4073ab093bff53f3b526b5f9969 /source
parentaa15c8a5bfdb11bccd9927f9bb77808d55c4356e (diff)
* Use same BLI_exist() on all platforms.
* remove extra sys/types.h include.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/intern/fileops.c16
-rw-r--r--source/blender/blenlib/intern/storage.c9
2 files changed, 11 insertions, 14 deletions
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index a543f4623f1..7a24d9b36b1 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -205,6 +205,10 @@ int BLI_touch(const char *file)
return 0;
}
+int BLI_exists(char *file) {
+ return BLI_exist(file);
+}
+
#ifdef WIN32
static char str[MAXPATHLEN+12];
@@ -282,10 +286,6 @@ int BLI_link(char *file, char *to) {
return 1;
}
-int BLI_exists(char *file) {
- return (GetFileAttributes(file) != 0xFFFFFFFF);
-}
-
void BLI_recurdir_fileops(char *dirname) {
char *lslash;
char tmp[MAXPATHLEN];
@@ -326,10 +326,10 @@ int BLI_rename(char *from, char *to) {
return rename(from, to);
}
-#else /* The sane UNIX world */
+#else /* The weirdo UNIX world */
/*
- * but the sane UNIX world is tied to the interface, and the system
+ * but the UNIX world is tied to the interface, and the system
* timer, and... We implement a callback mechanism. The system will
* have to initialise the callback before the functions will work!
* */
@@ -374,10 +374,6 @@ int BLI_link(char *file, char *to) {
return system(str);
}
-int BLI_exists(char *file) {
- return BLI_exist(file);
-}
-
void BLI_recurdir_fileops(char *dirname) {
char *lslash;
char tmp[MAXPATHLEN];
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);