#BUGFIX by stefan
authorStefan Vogel <sv@exept.de>
Mon, 28 Nov 2016 21:32:13 +0100
changeset 17117 7ccd2a0f7940
parent 17116 625f4a3de032
child 17118 5defea726711
#BUGFIX by stefan class: FileOperation::Create use Filename methods to create hard and symbolic links
FileOperation.st
--- a/FileOperation.st	Mon Nov 28 21:21:46 2016 +0100
+++ b/FileOperation.st	Mon Nov 28 21:32:13 2016 +0100
@@ -996,57 +996,57 @@
     resources := AbstractFileBrowser classResources.
 
     (oldPath size == 0) ifTrue:[
-	self operationError:'Missing source'.
-	^ self.
+        self operationError:'Missing source'.
+        ^ self.
     ].
     (newPath size == 0) ifTrue:[
-	self operationError:'Missing link name (target)'.
-	^ self.
+        self operationError:'Missing link name (target)'.
+        ^ self.
     ].
 
     newPathFile := newPath asFilename.
     oldPathFile := oldPath asFilename.
 
     newPathFile exists ifTrue:[
-	newPathFile isDirectory ifTrue:[
-	    newPathFile := newPathFile construct:(oldPathFile baseName).
-	    newPath := newPathFile name.
-	].
+        newPathFile isDirectory ifTrue:[
+            newPathFile := newPathFile construct:(oldPathFile baseName).
+            newPath := newPathFile name.
+        ].
     ].
 
     newPathFile exists ifTrue:[
-	self operationError:(resources string:'%1 already exists' with:newPath allBold).
-	^ self.
+        self operationError:(resources string:'%1 already exists' with:newPath allBold).
+        ^ self.
     ].
     oldPathFile exists ifFalse:[
-	symbolic ifTrue:[
-	    oldPathFile isAbsolute ifTrue:[
-		self operationError:(resources string:'%1 does not exist' with:oldPath allBold).
-		^ self.
-	    ].
-	    (newPathFile directory construct:oldPath) exists ifFalse:[
-		Dialog warn:(resources string:'%1 does not exist (Warning only)' with:oldPath allBold).
-	    ].
-	] ifFalse:[
-	    self operationError:(resources string:'%1 does not exist' with:oldPath allBold).
-	    ^ self.
-	].
+        symbolic ifTrue:[
+            oldPathFile isAbsolute ifTrue:[
+                self operationError:(resources string:'%1 does not exist' with:oldPath allBold).
+                ^ self.
+            ].
+            (newPathFile directory construct:oldPath) exists ifFalse:[
+                Dialog warn:(resources string:'%1 does not exist (Warning only)' with:oldPath allBold).
+            ].
+        ] ifFalse:[
+            self operationError:(resources string:'%1 does not exist' with:oldPath allBold).
+            ^ self.
+        ].
     ].
     ((symbolic not) and:[oldPathFile isDirectory]) ifTrue:[
-	self operationError:(resources string:'%1 is a directory' with:oldPath allBold).
-	^ self.
+        self operationError:(resources string:'%1 is a directory' with:oldPath allBold).
+        ^ self.
     ].
     ErrorSignal handle:[:ex |
-	err := ex errorString.
-	self operationError:err.
+        err := ex errorString.
+        self operationError:err.
     ] do:[
-	symbolic ifTrue:[
-	    OperatingSystem createSymbolicLinkFrom:oldPath to:newPath.
-	] ifFalse:[
-	    OperatingSystem createHardLinkFrom:oldPath to:newPath
-	].
-	self createdFile:newPathFile.
-	self result:true.
+        symbolic ifTrue:[
+            newPathFile createAsSymbolicLinkTo:oldPathFile.
+        ] ifFalse:[
+            newPathFile createAsHardLinkTo:oldPathFile.
+        ].
+        self createdFile:newPathFile.
+        self result:true.
     ].
 ! !