Mantis - Squeak
Viewing Issue Advanced Details
4799 Kernel minor always 09-09-06 14:44 09-09-06 14:44
Krivanek  
 
normal  
new 3.10  
open  
none    
none  
0004799: [KernelImageOverride] StandardFileStream fileExistsUserHandling:
StandardFileStream >> fileExistsUserHandling:

original:

fileExistsUserHandling: fullFileName
    | dir localName choice newName newFullFileName |
    dir := FileDirectory forFileName: fullFileName.
    localName := FileDirectory localNameFor: fullFileName.
    choice := (PopUpMenu
        labels:
'overwrite that file\choose another name\cancel' withCRs)
        startUpWithCaption: localName, '
already exists.'.

    choice = 1 ifTrue: [
        dir deleteFileNamed: localName
            ifAbsent: [self error: 'Could not delete the old version of that file'].
        ^ self new open: fullFileName forWrite: true].

    choice = 2 ifTrue: [
        newName := FillInTheBlank request: 'Enter a new file name' initialAnswer: fullFileName.
        newFullFileName := self fullName: newName.
        ^ self newFileNamed: newFullFileName].

    self error: 'Please close this to abort file opening'

override:

fileExistsUserHandling: fullFileName
    | dir localName choice newName newFullFileName |
    dir := FileDirectory forFileName: fullFileName.
    localName := FileDirectory localNameFor: fullFileName.
    choice := UIManager default
        chooseFrom: #('overwrite that file' 'choose another name' 'cancel' ) title: localName, '
already exists.'.

    choice = 1 ifTrue: [
        dir deleteFileNamed: localName
            ifAbsent: [self error: 'Could not delete the old version of that file'].
        ^ self new open: fullFileName forWrite: true].

    choice = 2 ifTrue: [
        newName := UIManager default request: 'Enter a new file name' initialAnswer: fullFileName.
        newFullFileName := self fullName: newName.
        ^ self newFileNamed: newFullFileName].

    self error: 'Please close this to abort file opening'


UI dependent code replaced with UIManager call

There are no notes attached to this issue.