[Pkg] The Trunk: Files-nice.84.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Aug 27 19:49:05 UTC 2010


Nicolas Cellier uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-nice.84.mcz

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

Name: Files-nice.84
Author: nice
Time: 27 August 2010, 9:46:35.718 pm
UUID: a166f43e-949e-b948-ae0d-5dad5c1c94bd
Ancestors: Files-ar.83

Apply #ifNil: simplification from Cuis

=============== Diff against Files-ar.83 ===============

Item was changed:
  ----- Method: StandardFileStream class>>readOnlyFileNamed: (in category 'file creation') -----
  readOnlyFileNamed: fileName 
  	"Open an existing file with the given name for reading."
  
  	| fullName f |
  	fullName := self fullName: fileName.
  	f := self new open: fullName forWrite: false.
+ 	^ f
+ 		ifNil: ["File does not exist..."
- 	^ f isNil
- 		ifFalse: [f]
- 		ifTrue: ["File does not exist..."
  			((FileDoesNotExistException fileName: fullName) readOnly: true) signal].
  
  	"StandardFileStream readOnlyFileNamed: 'kjsd.txt' "!

Item was changed:
  ----- Method: StandardFileStream class>>registry (in category 'registry') -----
  registry
  	WeakArray isFinalizationSupported ifFalse:[^nil].
+ 	^Registry
+ 		ifNil: [ Registry := WeakRegistry new]!
- 	^Registry isNil
- 		ifTrue:[Registry := WeakRegistry new]
- 		ifFalse:[Registry].!

Item was changed:
  ----- Method: StandardFileStream class>>forceNewFileNamed: (in category 'file creation') -----
  forceNewFileNamed: fileName 
  	"Create a new file with the given name, and answer a stream opened 
  	for writing on that file. If the file already exists, delete it without 
  	asking before creating the new file."
  	| dir localName fullName f |
  	fullName := self fullName: fileName.
  	(self isAFileNamed: fullName)
+ 		ifFalse: 
+ 			[f := self new open: fullName forWrite: true.
+ 			^ f
+ 				ifNil: ["Failed to open the file"
+ 					(FileDoesNotExistException fileName: fullName) signal]].
- 		ifFalse: [f := self new open: fullName forWrite: true.
- 			^ f isNil
- 				ifTrue: ["Failed to open the file"
- 					(FileDoesNotExistException fileName: fullName) signal]
- 				ifFalse: [f]].
  	dir := FileDirectory forFileName: fullName.
  	localName := FileDirectory localNameFor: fullName.
  	dir
  		deleteFileNamed: localName
  		ifAbsent: [(CannotDeleteFileException new
  			messageText: 'Could not delete the old version of file ' , fullName) signal].
  	f := self new open: fullName forWrite: true.
+ 	^ f
+ 		ifNil: ["Failed to open the file"
+ 			(FileDoesNotExistException fileName: fullName) signal]!
- 	^ f isNil
- 		ifTrue: ["Failed to open the file"
- 			(FileDoesNotExistException fileName: fullName) signal]
- 		ifFalse: [f]!



More information about the Packages mailing list