[squeak-dev] The Trunk: Files-cmm.119.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jun 22 16:04:56 UTC 2012


Chris Muller uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-cmm.119.mcz

==================== Summary ====================

Name: Files-cmm.119
Author: cmm
Time: 22 June 2012, 11:04:28.076 am
UUID: c68699c7-5cde-4ed0-8773-a25cad7f33fe
Ancestors: Files-cmm.118

- Fix file renaming UI guard.

=============== Diff against Files-eem.117 ===============

Item was changed:
  ----- Method: FileDirectory>>rename:toBe: (in category 'file operations') -----
+ rename: oldFileName toBe: newFileName 
- 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"
+ 	| selection oldName newName |
  	oldName := self fullNameFor: oldFileName.
  	newName := self fullNameFor: newFileName.
+ 	(self fileExists: oldFileName) ifFalse: [ ^ self error: 'Attempt to rename a non-existent file' ].
+ 	(self fileExists: newFileName) ifTrue:
+ 		[ selection := UIManager default
+ 			chooseFrom: #('delete version in target directory' 'cancel' )
+ 			title: newFileName , ' already exists'.
+ 		selection = 1
+ 			ifTrue: [ self deleteFileNamed: newFileName ]
+ 			ifFalse: [ ^ self ] ].
+ 	(StandardFileStream
+ 		retryWithGC:
+ 			[ self
+ 				primRename: oldName asVmPathName
+ 				to: newName asVmPathName ]
+ 		until: [ : result | result notNil ]
+ 		forFileNamed: oldName) ~~ nil ifTrue: [ ^ self ].
+ 	^ self error: 'Failed to rename file'!
- 	(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')
- 				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'.!



More information about the Squeak-dev mailing list