Merge jv
authorMerge Script
Mon, 13 Apr 2015 06:41:26 +0200
branchjv
changeset 15574 9f53df941beb
parent 15571 a7d3835c6a86 (current diff)
parent 15573 13c2803a55c0 (diff)
child 15577 2420fc84e5c7
child 15582 3fd5977bf5af
Merge
FileOperation.st
--- a/.hgtags	Fri Apr 10 07:05:29 2015 +0200
+++ b/.hgtags	Mon Apr 13 06:41:26 2015 +0200
@@ -38,7 +38,7 @@
 8314abc6ed8f5dfeb3e68dbe88b8e5761c3be95f expecco_1_8_0rc1
 86b5d78f396e640514438498a168d5259ea7dd79 rel4_1_7
 86b5d78f396e640514438498a168d5259ea7dd79 release
-89c530367f306b4c491462ce9c4edb9da5c138ec expeccoALM_1_9_0_1
+8a55a3ddbe8dbab47d298dde127ac6904f7b6470 expeccoALM_1_9_0_1
 8b31177ded1bd9e0de5e2cec5271a827e08f8778 rel5_1_4
 91902ae3978238320aa4642b129b0bd1ac3983fe expecco_1_7_0rc1
 94c64ad24577fdc86cbc80e55c5ca7ff502c094b expecco_2_4_0
--- a/FileOperation.st	Fri Apr 10 07:05:29 2015 +0200
+++ b/FileOperation.st	Mon Apr 13 06:41:26 2015 +0200
@@ -90,8 +90,8 @@
 !FileOperation class methodsFor:'instance creation'!
 
 copyCorruptedFile:aSourceFile to:aDestFile
-    ^ CopyCorrupted
-	copyFile:aSourceFile to:aDestFile
+    ^ CopyCorrupted new
+        copyFile:aSourceFile to:aDestFile withOverWriteWarning:false copyFileIfSame:false
 
     "Created: / 07-02-2007 / 18:41:24 / cg"
 !
@@ -235,7 +235,7 @@
     "
 
     |msg oldSize newSize sameContents resources sourceType destType labels values default olderOrNewer
-     forAllHolder answer oldFileIsDirectory newFileIsDirectory|
+     forAllHolder answer oldFileIsDirectory newFileIsDirectory oldFileTime newFileTime|
 
     newFile exists ifFalse:[ ^ true ].
     oldSize := oldFile fileSize.
@@ -271,18 +271,20 @@
     ] ifFalse:[
         msg := 'Overwrite existing destination %7:\\  %1\    size: %3 of %2\\with %8 source:\\  %4\    size: %6 of %5'.
     ].
+    newFileTime := newFile modificationTime ? Timestamp now.
+    oldFileTime := oldFile modificationTime ? Timestamp now.
 
-    olderOrNewer := newFile modificationTime < oldFile modificationTime
+    olderOrNewer := newFileTime < oldFileTime    
                     ifTrue:[ 'newer' ]
                     ifFalse:[ 'older' ].
     msg := resources
             stringWithCRs:msg
             withArgs:(Array
                 with:newFile asString allBold
-                with:(newFile modificationTime printStringFormat:'%(Day)-%(mon)-%(year) %h:%m:%s')
+                with:(newFileTime printStringFormat:'%(Day)-%(mon)-%(year) %h:%m:%s')
                 with:newSize
                 with:oldFile asString allBold
-                with:(oldFile modificationTime printStringFormat:'%(Day)-%(mon)-%(year) %h:%m:%s')
+                with:(oldFileTime printStringFormat:'%(Day)-%(mon)-%(year) %h:%m:%s')
                 with:oldSize
                 with:destType
                 with:(resources string:olderOrNewer) ).
@@ -417,7 +419,7 @@
 !
 
 copyFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning
-    self copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true
+    self copyFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning copyFileIfSame:true
 !
 
 copyFiles:aColOfSourceFiles to:aDirectory
@@ -452,7 +454,7 @@
         newFile := aDestFile.
     ].
 
-    "/ do not copy if destination directory doest exist.
+    "/ do not copy if destination directory doesnt exist.
     (self checkDirectoryExists:targetDirectory) ifFalse:[
         result := false.
         ^ self
@@ -471,8 +473,10 @@
                     ^ self.
                 ]
             ] ifFalse:[
+                (Dialog confirm:('Destination "%1" exists - overwrite?' bindWith:aDestFile)) ifFalse:[
                     result := false.
                     ^ self.
+                ]
             ]
         ].
     ].
@@ -582,7 +586,10 @@
     buffer := ByteArray new:(self bufferSize).
     bufferSize := buffer size.
     offset := 0.
-    fileSize := sourceFile fileSize.
+    sourceFile info isCharacterSpecial ifTrue:[
+    ] ifFalse:[
+        fileSize := sourceFile fileSize.
+    ].
     in := sourceFile readStream binary.
     out := destFile writeStream binary.
 
@@ -604,8 +611,18 @@
                ].
 
     [
-        [offset < fileSize] whileTrue:[
-            doRead value:(bufferSize min:(fileSize - offset)).
+        [
+            (fileSize notNil 
+                ifTrue:[offset < fileSize]
+                ifFalse:[true "in atEnd not"])
+        ] whileTrue:[
+            |n|
+
+            n := fileSize notNil 
+                    ifTrue:[ bufferSize min:(fileSize - offset) ]
+                    ifFalse:[ bufferSize ].
+            Transcript show:'read @'; showCR:offset.
+            doRead value:n.
             nRead > 0 ifTrue:[
                 lostStart notNil ifTrue:[
                     Transcript showCR:'CORRUPT: ',(lostStart printString),' .. ',(lostEnd printString).
@@ -614,7 +631,7 @@
                 doWrite value:nRead.
             ].
 
-            nRead == (bufferSize min:(fileSize - offset)) ifTrue:[
+            nRead == n ifTrue:[
                 bufferSize < buffer size ifTrue:[
                     bufferSize := bufferSize * 2.
                 ].
@@ -676,7 +693,7 @@
                     ]
                 ].
             ].
-            Transcript showCR:offset.
+            Transcript show:'wrote @'; showCR:offset.
         ].
     ] ensure:[
         in close.
@@ -1633,10 +1650,10 @@
 !FileOperation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.98 2015-02-27 18:55:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.99 2015-04-12 15:01:54 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.98 2015-02-27 18:55:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.99 2015-04-12 15:01:54 cg Exp $'
 ! !