[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17000] trunk/blender/source/blender/ blenlib/intern/fileops.c: fix for [#12255] Rename the File at File Window, the file is deleted

Campbell Barton ideasman42 at gmail.com
Fri Oct 10 00:44:52 CEST 2008


Revision: 17000
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17000
Author:   campbellbarton
Date:     2008-10-10 00:44:52 +0200 (Fri, 10 Oct 2008)

Log Message:
-----------
fix for [#12255] Rename the File at File Window,the file is deleted

renaming a file on win32 would delete it because it didnt test if the 2 filenames were the same (case insensitive), and remove the 'to' file to make way for the 'from' file.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/fileops.c

Modified: trunk/blender/source/blender/blenlib/intern/fileops.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/fileops.c	2008-10-09 22:28:44 UTC (rev 16999)
+++ trunk/blender/source/blender/blenlib/intern/fileops.c	2008-10-09 22:44:52 UTC (rev 17000)
@@ -303,7 +303,8 @@
 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) && strcasecmp(from, to))
 		if(BLI_delete(to, 0, 0)) return 1;
 		
 	return rename(from, to);





More information about the Bf-blender-cvs mailing list