diff options
author | Andrea Weikert <elubie@gmx.net> | 2009-07-28 22:07:00 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2009-07-28 22:07:00 +0400 |
commit | 86336f5cdd2bbe607bbece162bddfade7062b305 (patch) | |
tree | be4ec5b36fa8602ff7cbd7b1548fa90d7c74f693 /source/blender/blenlib/intern | |
parent | a5e1ff294e9e4b2a8b50f197693283f59eb4ff43 (diff) |
2.5 file browser
Bugfix: revert to previous behaviour of BLI_rename, is used for safe blendfile saving.
Added guard in file browser though to prevent user from invoking this.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index b9c0dd65ede..0228032df01 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -311,9 +311,9 @@ void BLI_recurdir_fileops(char *dirname) { int BLI_rename(char *from, char *to) { if (!BLI_exists(from)) return 0; - /* refuse to rename if file already exists */ - if (BLI_exists(to)) - return 1; + /* 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); } @@ -391,8 +391,7 @@ void BLI_recurdir_fileops(char *dirname) { int BLI_rename(char *from, char *to) { if (!BLI_exists(from)) return 0; - /* refuse to rename if file already exists */ - if (BLI_exists(to)) return 1; + if (BLI_exists(to)) if(BLI_delete(to, 0, 0)) return 1; return rename(from, to); } |