FileOperations.st
author penk
Wed, 04 Sep 2002 14:23:01 +0200
changeset 1588 6dde5ad32643
parent 1585 91ec771207a2
permissions -rw-r--r--
now ready to use

"{ Package: 'stx:libtool2' }"

Object subclass:#FileOperations
	instanceVariableNames:'errorString result'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Support'
!


!FileOperations class methodsFor:'defaults'!

copyMoveIfExistSuffixString

    ^ '.copy'
! !

!FileOperations methodsFor:'accessing'!

errorString
    "return the value of the static variable 'ErrorString' (automatically generated)"

    ^ errorString
!

errorString:something
    "set the value of the static variable 'ErrorString' (automatically generated)"

    errorString := something.
!

result
    "return the value of the instance variable 'result' (automatically generated)"

    ^ result
!

result:something
    "set the value of the instance variable 'result' (automatically generated)"

    result := something.
! !

!FileOperations methodsFor:'dialogs'!

fileExistDialogFor:aFile

    ^ self fileExistDialogFor:aFile withCancel:false.
!

fileExistDialogFor:aFile withCancel:aBoolean
    | stream string|

    aFile exists ifTrue:[
        stream := WriteStream on:''.
        stream nextPutAll:'overwrite '.
        stream nextPutAll:(aFile asString).
        stream nextPutAll:' from '.
        (aFile modificationTime) printOn:stream format:'%(Day)-%(mon)-%(year) %h:%m:%s'.
        stream nextPutAll:' with size of '.
        stream nextPutAll:aFile fileSize asString.
        stream cr.
        stream nextPutAll:' with '.
        stream nextPutAll:aFile asString.
        stream nextPutAll:' from '.
        (aFile modificationTime) printOn:stream format:'%(Day)-%(mon)-%(year) %h:%m:%s'.
        stream nextPutAll:' with size of '.
        stream nextPutAll:aFile fileSize asString.
        string := stream contents. 
        stream close.
        aBoolean ifTrue:[
            ^ (Dialog confirmWithCancel:(string)).
        ] ifFalse:[
            ^ (Dialog confirm:(string)).
        ].
    ].
    ^ true
! !

!FileOperations class methodsFor:'documentation'!

version
    ^ '$Header$'
! !