diff options
author | Andrea Weikert <elubie@gmx.net> | 2006-03-19 16:28:01 +0300 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2006-03-19 16:28:01 +0300 |
commit | 368cab399c0d7fac73929a79ee829812d9463a8f (patch) | |
tree | 0e5ac2b4445e0c4889ddff1ffd3bcfc643d56e74 /source/blender/python/api2_2x/Sys.c | |
parent | 59ed566e86eaa7514101777910ac99fb2fdd3c2d (diff) |
=== bugfix win32 - python ===
Fixed BLI_exist: In Windows stat doesn't recognize
a dirname ending is a slash, exept when it's
the root dir ("C:\\"), where it is required.
So trailing slashes are only removed when filename
is longer than 3 chars.
Also fixed Python Sys.c that now uses BLI_exist
instead of calling stat directly.
Diffstat (limited to 'source/blender/python/api2_2x/Sys.c')
-rw-r--r-- | source/blender/python/api2_2x/Sys.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/python/api2_2x/Sys.c b/source/blender/python/api2_2x/Sys.c index 305ed0a0653..c684a179039 100644 --- a/source/blender/python/api2_2x/Sys.c +++ b/source/blender/python/api2_2x/Sys.c @@ -388,19 +388,19 @@ static PyObject *M_sys_exists( PyObject * self, PyObject * args ) { struct stat st; char *fname = NULL; - int res = 0, i = -1; + int mode = 0, i = -1; if( !PyArg_ParseTuple( args, "s", &fname ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected string (pathname) argument" ); - res = stat( fname, &st ); - - if( res == -1 ) + mode = BLI_exist(fname); + + if( mode == 0 ) i = 0; - else if( S_ISREG( st.st_mode ) ) + else if( S_ISREG( mode ) ) i = 1; - else if( S_ISDIR( st.st_mode ) ) + else if( S_ISDIR( mode ) ) i = 2; /* i stays as -1 if path exists but is neither a regular file nor a dir */ |