Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004829 [Squeak] Kernel minor always 09-09-06 17:37 07-25-13 10:22
Reporter Krivanek View Status public  
Assigned To FrankShearar
Priority normal Resolution no change required  
Status resolved   Product Version 3.10
Summary 0004829: [KernelImageOverride] FileDirectory rename:toBe:
Description FileDirectory >> rename:toBe:

original:

rename: oldFileName toBe: newFileName
    | selection oldName newName |
    "Rename the file of the given name to the new name. Fail if there is no file of the old name or if there is an existing file with the new name."
    "Modified for retry after GC ar 3/21/98 18:09"
    oldName := self fullNameFor: oldFileName.
    newName := self fullNameFor: newFileName.
    (StandardFileStream
        retryWithGC:[self primRename: oldName asVmPathName to: newName asVmPathName]
        until:[:result| result notNil]
        forFileNamed: oldName) ~~ nil ifTrue:[^self].
    (self fileExists: oldFileName) ifFalse:[
        ^self error:'Attempt to rename a non-existent file'.
    ].
    (self fileExists: newFileName) ifTrue:[
        selection := (PopUpMenu labels:
'delete old version
cancel')
                startUpWithCaption: 'Trying to rename a file to be
', newFileName , '
and it already exists.'.
        selection = 1 ifTrue:
            [self deleteFileNamed: newFileName.
            ^ self rename: oldFileName toBe: newFileName]].
    ^self error:'Failed to rename file'.

override:

rename: oldFileName toBe: newFileName
    | selection oldName newName |
    "Rename the file of the given name to the new name. Fail if there is no file of the old name or if there is an existing file with the new name."
    "Modified for retry after GC ar 3/21/98 18:09"
    oldName := self fullNameFor: oldFileName.
    newName := self fullNameFor: newFileName.
    (StandardFileStream
        retryWithGC:[self primRename: oldName asVmPathName to: newName asVmPathName]
        until:[:result| result notNil]
        forFileNamed: oldName) ~~ nil ifTrue:[^self].
    (self fileExists: oldFileName) ifFalse:[
        ^self error:'Attempt to rename a non-existent file'.
    ].
    (self fileExists: newFileName) ifTrue:[
        selection := UIManager default chooseFrom: #('delete old version' 'cancel') values: #(1 2) title: 'Trying to rename a file to be
', newFileName , '
and it already exists.'..
        selection = 1 ifTrue:
            [self deleteFileNamed: newFileName.
            ^ self rename: oldFileName toBe: newFileName]].
    ^self error:'Failed to rename file'.

UI dependent code replaced with UIManager message
Additional Information
Attached Files

- Relationships

- Notes
(0014421 - 103 - 103 - 103 - 103 - 103 - 103)
FrankShearar
07-25-13 10:22

I replaced the UI reference with a resumable exception, ReplaceExistingFileException, in Files-fbs.125.
 

- Issue History
Date Modified Username Field Change
09-09-06 17:37 Krivanek New Issue
07-25-13 10:22 FrankShearar Status new => resolved
07-25-13 10:22 FrankShearar Resolution open => no change required
07-25-13 10:22 FrankShearar Assigned To  => FrankShearar
07-25-13 10:22 FrankShearar Note Added: 0014421


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
35 total queries executed.
30 unique queries executed.
Powered by Mantis Bugtracker