diff options
author | Martin Poirier <theeth@yahoo.com> | 2008-10-20 04:48:10 +0400 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2008-10-20 04:48:10 +0400 |
commit | a806c1eb7f53cca7c65775b7ce849d31c12902f9 (patch) | |
tree | f4554b9212dc021b6f932dd1093a66da30cbef26 /source/blender/blenlib | |
parent | d16a8649ff6c2b65492a78eab80bcdbefa9dbe9d (diff) | |
parent | 90721f3f835fca7fed7dce99a2b7b447eba50e26 (diff) |
merge 16951:17122
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/dynlib.c | 7 | ||||
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c index e7fa3332f43..858aa6e60bf 100644 --- a/source/blender/blenlib/intern/dynlib.c +++ b/source/blender/blenlib/intern/dynlib.c @@ -78,10 +78,7 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) { /* if lib is NULL reset the last error code */ err= GetLastError(); - if (!lib) { - SetLastError(ERROR_SUCCESS); - err = ERROR_SUCCESS; - } + if (!lib) SetLastError(ERROR_SUCCESS); if (err) { static char buf[1024]; @@ -96,7 +93,7 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) { return buf; } - return "unrecognized error"; + return err; } void PIL_dynlib_close(PILdynlib *lib) { diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 2acbbbe6712..ebd8f4be1cf 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -95,12 +95,12 @@ char *BLI_last_slash(const char *string) { void BLI_add_slash(char *string) { int len = strlen(string); #ifdef WIN32 - if (string[len-1]!='\\') { + if (len==0 || string[len-1]!='\\') { string[len] = '\\'; string[len+1] = '\0'; } #else - if (string[len-1]!='/') { + if (len==0 || string[len-1]!='/') { string[len] = '/'; string[len+1] = '\0'; } @@ -303,7 +303,8 @@ void BLI_recurdir_fileops(char *dirname) { int BLI_rename(char *from, char *to) { if (!BLI_exists(from)) return 0; - if (BLI_exists(to)) + /* make sure the filenames are different (case insensitive) before removing */ + if (BLI_exists(to) && BLI_strcasecmp(from, to)) if(BLI_delete(to, 0, 0)) return 1; return rename(from, to); |