class: Filename
authorStefan Vogel <sv@exept.de>
Fri, 23 May 2014 21:42:31 +0200
changeset 16490 1be874f7ae34
parent 16489 7d7c4d8c47fe
child 16491 e0d1851e8511
class: Filename changed: #moveTo: #renameTo: #safeCopyTo: fix saveCoyTo:'~/something'
Filename.st
--- a/Filename.st	Fri May 23 21:14:03 2014 +0200
+++ b/Filename.st	Fri May 23 21:42:31 2014 +0200
@@ -3009,12 +3009,15 @@
     "
 !
 
-moveTo:newName
+moveTo:newNameArg
     "copy the file represented by the receiver, then delete it.
      This is different to renaming in case of cross device moves.
      Raise an exception if not successful.
      (Notice, that a rename is tried first, in case of non-cross device move)"
 
+    |newName|
+
+    newName := newNameArg asFilename.    
     [self renameTo:newName] 
         on:(OSErrorHolder inappropriateReferentSignal) 
         do:[:ex |
@@ -3352,16 +3355,17 @@
     "
 !
 
-renameTo:newName
+renameTo:newNameArg
     "rename the file - the argument must be convertable to a String.
      Raises an exception if not successful.
      If newName already exists, it will be replaced by myself."
 
-    |errno|
-
+    |errno newName|
+
+    newName := newNameArg asFilename.
     (OperatingSystem 
         renameFile:(self osNameForFile) 
-        to:(newName asFilename osNameForFile)
+        to:(newName osNameForFile)
     ) ifFalse:[
         errno := OperatingSystem lastErrorNumber.
 
@@ -3369,7 +3373,7 @@
             ^ self fileNotFoundError:self
         ].
         (OperatingSystem errorHolderForNumber:errno) 
-            parameter:newName asFilename;
+            parameter:newName;
             reportError.
     ].
 
@@ -3402,7 +3406,7 @@
 
     [
         "let the temp filename start with a ~ to make it invisible"    
-        tempStream := FileStream newTemporaryIn:newName directory nameTemplate:'~%1_%2'.
+        tempStream := FileStream newTemporaryIn:newName directory osNameForFile nameTemplate:'~%1_%2'.
         [
             "would be nice to keep the access rights of the original test suite"    
             tempStream fileName accessRights:accessRights.
@@ -6136,11 +6140,11 @@
 !Filename class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.415 2014-05-22 17:49:07 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.416 2014-05-23 19:42:31 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.415 2014-05-22 17:49:07 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.416 2014-05-23 19:42:31 stefan Exp $'
 ! !