Filename.st
branchjv
changeset 19967 9b1443c2aab1
parent 19861 95c7068e30ba
parent 19957 1d663e2ea5bc
child 20083 196706395bbc
--- a/Filename.st	Wed Jun 08 14:07:35 2016 +0100
+++ b/Filename.st	Thu Jun 09 01:47:28 2016 +0100
@@ -3172,34 +3172,38 @@
 
     newName := newNameArg asFilename.
 
-    "Contents is not copied if newName represent same file as me."
+    "Contents is not copied if newName represents the same file as me."
     newName asAbsoluteFilename = self asAbsoluteFilename ifTrue: [ ^ self ].
 
+    (newName exists and:[newName isDirectory]) ifTrue:[
+        newName := newName construct:(self baseName).
+    ].
+
     inStream := self readStream.
     inStream isNil ifTrue:[
-	"open failed, but somenone did a proceed for the OpenError.
-	 Ignore this file but continue in order to copy the rest when
-	 doing a recursive copy"
-	^ self.
+        "open failed, but somenone did a proceed for the OpenError.
+         Ignore this file but continue in order to copy the rest when
+         doing a recursive copy"
+        ^ self.
     ].
 
     [
-	newNameAlreadyExists := newName exists.
-	outStream := newName writeStream.
-	newNameAlreadyExists ifFalse:[
-	    [
-		"would be nice to keep the access rights of the original test suite"
-		newName accessRights:self accessRights.
-	    ] on:OperatingSystem accessDeniedErrorSignal do:[:ex|
-		"ignore the error - may occure when copying to a network drive"
-	    ].
-	].
-	inStream binary; buffered:false.
-	outStream binary; buffered:false.
-	inStream copyToEndInto:outStream.
+        newNameAlreadyExists := newName exists.
+        outStream := newName writeStream.
+        newNameAlreadyExists ifFalse:[
+            [
+                "would be nice to keep the access rights of the original test suite"
+                newName accessRights:self accessRights.
+            ] on:OperatingSystem accessDeniedErrorSignal do:[:ex|
+                "ignore the error - may occure when copying to a network drive"
+            ].
+        ].
+        inStream binary; buffered:false.
+        outStream binary; buffered:false.
+        inStream copyToEndInto:outStream.
     ] ensure:[
-	inStream close.
-	outStream notNil ifTrue:[outStream close].
+        inStream close.
+        outStream notNil ifTrue:[outStream close].
     ].
 
     "
@@ -3209,7 +3213,7 @@
     "
 
     "Modified: / 10-09-2004 / 09:49:28 / janfrog"
-    "Modified: / 29-09-2006 / 16:26:32 / cg"
+    "Modified: / 06-06-2016 / 12:15:25 / cg"
 !
 
 copyToStream:outStream