From 86336f5cdd2bbe607bbece162bddfade7062b305 Mon Sep 17 00:00:00 2001 From: Andrea Weikert Date: Tue, 28 Jul 2009 18:07:00 +0000 Subject: 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. --- source/blender/blenlib/intern/fileops.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'source/blender/blenlib') 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); } -- cgit v1.2.3