[squeak-dev] The Inbox: Files-cmm.118.mcz

commits at source.squeak.org commits at source.squeak.org
Mon May 28 02:39:43 UTC 2012


A new version of Files was added to project The Inbox:
http://source.squeak.org/inbox/Files-cmm.118.mcz

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

Name: Files-cmm.118
Author: cmm
Time: 27 May 2012, 9:39:33.09 pm
UUID: f13f4d5e-ec34-440f-bbee-1b14db589ff4
Ancestors: Files-eem.117

- Fix guards in FileDirectory>>#rename:toBe:.

=============== 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