# HG changeset patch # User penk # Date 1031153744 -7200 # Node ID d5692dd573267d1e38fbe4123b873143e47ff3cf # Parent 89e229528104dd58693be5d67f8ce80bbb89af9f removed via FileBrowser diff -r 89e229528104 -r d5692dd57326 Create.st --- a/Create.st Wed Sep 04 17:26:34 2002 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -"{ Package: 'stx:libtool2' }" - -FileOperations subclass:#Create - instanceVariableNames:'' - classVariableNames:'' - poolDictionaries:'' - category:'Interface-Support' -! - - -!Create class methodsFor:'actions'! - -createDirectory:newName - - |instance| - - instance := self new. - instance createDirectory:newName. - ^ instance -! - -createFile:newName - - |instance| - - instance := self new. - instance createFile:newName. - ^ instance -! ! - -!Create methodsFor:'actions'! - -createDirectory:newName - |msg| - - newName exists ifTrue:[ - DialogBox warn:(newName, ' already exists.'). - result := false. - ^ self - ]. - - newName makeDirectory ifFalse:[ - msg := errorString := ('cannot create directory '', newName,'' !!') , '\\(' , (OperatingSystem lastErrorString) , ')'. - errorString := msg withCRs. - DialogBox warn:errorString. - result := false. - ^ self - ]. - result := true. -! - -createFile:file - "create an empty file" - - |aStream newName msg| - - newName := file baseName. - file exists ifTrue:[ - (Dialog - confirm:(newName, ' already exists\\truncate ?') withCRs - yesLabel:('Truncate') - noLabel:('Cancel')) - ifFalse:[^ self]. - ]. - - FileStream openErrorSignal handle:[:ex| - msg := ('Cannot create file '', newName,'' !!') , '\\(' , (FileStream lastErrorString) , ')'. - errorString := msg withCRs. - ^ DialogBox warn:errorString - ] do:[ - aStream := file newReadWriteStream. - ]. - aStream notNil ifTrue:[ - aStream close. - ] ifFalse:[ - msg := ('Cannot create file '', newName, '' !!') , '\\(' , (FileStream lastErrorString) , ')'. - errorString := msg withCRs. - ^ DialogBox warn:errorString - ]. -! ! - -!Create class methodsFor:'documentation'! - -version - ^ '$Header$' -! !