FileOperations.st
changeset 1585 91ec771207a2
child 1588 6dde5ad32643
equal deleted inserted replaced
1584:51c53d6656f4 1585:91ec771207a2
       
     1 "{ Package: 'stx:libtool2' }"
       
     2 
       
     3 Object subclass:#FileOperations
       
     4 	instanceVariableNames:'errorString result'
       
     5 	classVariableNames:''
       
     6 	poolDictionaries:''
       
     7 	category:'Interface-Support'
       
     8 !
       
     9 
       
    10 
       
    11 !FileOperations methodsFor:'accessing'!
       
    12 
       
    13 errorString
       
    14     "return the value of the static variable 'ErrorString' (automatically generated)"
       
    15 
       
    16     ^ errorString
       
    17 !
       
    18 
       
    19 errorString:something
       
    20     "set the value of the static variable 'ErrorString' (automatically generated)"
       
    21 
       
    22     errorString := something.
       
    23 !
       
    24 
       
    25 result
       
    26     "return the value of the instance variable 'result' (automatically generated)"
       
    27 
       
    28     ^ result
       
    29 !
       
    30 
       
    31 result:something
       
    32     "set the value of the instance variable 'result' (automatically generated)"
       
    33 
       
    34     result := something.
       
    35 ! !
       
    36 
       
    37 !FileOperations methodsFor:'dialogs'!
       
    38 
       
    39 fileExistDialogFor:aFile
       
    40     | stream string|
       
    41 
       
    42     aFile exists ifTrue:[
       
    43         stream := WriteStream on:''.
       
    44         stream nextPutAll:'overwrite '.
       
    45         stream nextPutAll:(aFile asString).
       
    46         stream nextPutAll:' from '.
       
    47         (aFile modificationTime) printOn:stream format:'%(Day)-%(mon)-%(year) %h:%m:%s'.
       
    48         stream nextPutAll:' with size of '.
       
    49         stream nextPutAll:aFile fileSize asString.
       
    50         stream cr.
       
    51         stream nextPutAll:' with '.
       
    52         stream nextPutAll:aFile asString.
       
    53         stream nextPutAll:' from '.
       
    54         (aFile modificationTime) printOn:stream format:'%(Day)-%(mon)-%(year) %h:%m:%s'.
       
    55         stream nextPutAll:' with size of '.
       
    56         stream nextPutAll:aFile fileSize asString.
       
    57         string := stream contents. 
       
    58         stream close.
       
    59         ^ (Dialog confirm:(string)).
       
    60     ].
       
    61     ^ true
       
    62 ! !
       
    63 
       
    64 !FileOperations class methodsFor:'documentation'!
       
    65 
       
    66 version
       
    67     ^ '$Header$'
       
    68 ! !