care for same-name rename on OS which is not filename-case-sensitive
authorClaus Gittinger <cg@exept.de>
Thu, 21 Sep 2006 18:33:38 +0200
changeset 7335 1794c7bc151c
parent 7334 e0bd092badd1
child 7336 7d3e8f79f053
care for same-name rename on OS which is not filename-case-sensitive
FileBrowser.st
--- a/FileBrowser.st	Thu Sep 21 18:31:58 2006 +0200
+++ b/FileBrowser.st	Thu Sep 21 18:33:38 2006 +0200
@@ -6629,17 +6629,13 @@
 doRename:oldName to:newName
     "rename a file (or directory)"
 
-    |old new|
-
-    (oldName isNil or:[newName isNil]) ifTrue:[
-        ^ self
-    ].
-    (oldName isBlank or:[newName isBlank]) ifTrue:[
-        ^ self
-    ].
-    (oldName = newName) ifTrue:[
-        ^ self
-    ].
+    |old new sameFile|
+
+    (oldName isNil or:[newName isNil]) ifTrue:[ ^ self ].
+    (oldName isBlank or:[newName isBlank]) ifTrue:[ ^ self ].
+    (oldName = newName) ifTrue:[ ^ self ].
+
+    sameFile := Filename isCaseSensitive not and:[ oldName sameAs: newName ].
 
     old := currentDirectory filenameFor:oldName.
     new := currentDirectory filenameFor:newName.
@@ -6649,11 +6645,13 @@
                                   with:oldName with:newName)
                   with:(OperatingSystem lastErrorString)
     ] do:[
-        new exists ifTrue:[
-            (self confirm:(resources string:'''%1'' already exists - rename (i.e. overwrite) anyway ?' with:new baseName allBold))
-            ifFalse:[
-                ^ self
-            ]
+        sameFile ifFalse:[
+            new exists ifTrue:[
+                (self confirm:(resources string:'''%1'' already exists - rename (i.e. overwrite) anyway ?' with:new baseName allBold))
+                ifFalse:[
+                    ^ self
+                ]
+            ].
         ].
         old renameTo:new.
     ].
@@ -6661,8 +6659,8 @@
     self updateCurrentDirectory
     "/ self updateCurrentDirectoryIfChanged.
 
-    "Modified: / 24.9.1997 / 09:20:00 / stefan"
-    "Modified: / 16.11.2001 / 00:44:27 / cg"
+    "Modified: / 24-09-1997 / 09:20:00 / stefan"
+    "Modified: / 21-09-2006 / 18:34:45 / cg"
 ! !
 
 !FileBrowser methodsFor:'private-file type & info'!
@@ -7500,5 +7498,5 @@
 !FileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.616 2006-09-21 14:27:11 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.617 2006-09-21 16:33:38 cg Exp $'
 ! !