[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30353] trunk/blender/source/blender/ blenlib/intern: * Use same BLI_exist() on all platforms.
Nathan Letwory
nathan at letworyinteractive.com
Thu Jul 15 01:39:23 CEST 2010
Revision: 30353
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30353
Author: jesterking
Date: 2010-07-15 01:39:23 +0200 (Thu, 15 Jul 2010)
Log Message:
-----------
* Use same BLI_exist() on all platforms.
* remove extra sys/types.h include.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/fileops.c
trunk/blender/source/blender/blenlib/intern/storage.c
Modified: trunk/blender/source/blender/blenlib/intern/fileops.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/fileops.c 2010-07-14 23:28:44 UTC (rev 30352)
+++ trunk/blender/source/blender/blenlib/intern/fileops.c 2010-07-14 23:39:23 UTC (rev 30353)
@@ -205,6 +205,10 @@
return 0;
}
+int BLI_exists(char *file) {
+ return BLI_exist(file);
+}
+
#ifdef WIN32
static char str[MAXPATHLEN+12];
@@ -282,10 +286,6 @@
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 @@
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 @@
return system(str);
}
-int BLI_exists(char *file) {
- return BLI_exist(file);
-}
-
void BLI_recurdir_fileops(char *dirname) {
char *lslash;
char tmp[MAXPATHLEN];
Modified: trunk/blender/source/blender/blenlib/intern/storage.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/storage.c 2010-07-14 23:28:44 UTC (rev 30352)
+++ trunk/blender/source/blender/blenlib/intern/storage.c 2010-07-14 23:39:23 UTC (rev 30353)
@@ -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_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);
More information about the Bf-blender-cvs
mailing list