[squeak-dev] Squeak 4.5: Files-cmm.131.mcz

commits at source.squeak.org commits at source.squeak.org
Wed May 7 02:52:02 UTC 2014


Chris Muller uploaded a new version of Files to project Squeak 4.5:
http://source.squeak.org/squeak45/Files-cmm.131.mcz

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

Name: Files-cmm.131
Author: cmm
Time: 16 March 2014, 8:32:48.306 pm
UUID: 9a3c6155-2a88-4fb8-b07a-be3743989188
Ancestors: Files-dtl.130

- Extract Levente's improved file-copy from SmalltalkImage>>#appendChangesTo: (into FileDirectory>>#copyFile:toFile:) which honors copy semantics without needing to make assumptions about the streams passed.
- Minor factoring for FileDirectory>>#directoryEntryFor:.
- Add String>>#asDirectoryEntry conversion method.

=============== Diff against Files-dtl.130 ===============

Item was changed:
  ----- Method: FileDirectory>>copyFile:toFile: (in category 'file operations') -----
+ copyFile: fileStream1 toFile: fileStream2 
- copyFile: fileStream1 toFile: fileStream2
  	| buffer |
+ 	fileStream1 position: 0.
+ 	fileStream2 truncate.
  	buffer := String new: 50000.
+ 	[ fileStream1 atEnd ] whileFalse: [ fileStream2 nextPutAll: (fileStream1 nextInto: buffer) ].
+ 	fileStream2 position < fileStream1 size ifTrue: [ self error: 'File copy failed' ]!
- 	[fileStream1 atEnd] whileFalse:
- 		[fileStream2 nextPutAll: (fileStream1 nextInto: buffer)].
- !

Item was changed:
  ----- Method: FileDirectory>>directoryEntryFor: (in category 'enumeration') -----
  directoryEntryFor: filenameOrPath
+ 	"Answer the directory entry for the given file or path."
+ 	^ DirectoryClass
- 	"Answer the directory entry for the given file or path. Sorta like a poor man's stat()."
- 	| fName dir |
- 	DirectoryClass
  		splitName: filenameOrPath
+ 		to:
+ 			[ : filePath : name | | filename directory |
+ 			filename := name.
+ 			directory := filePath isEmpty
+ 				ifTrue: [ self ]
+ 				ifFalse: [ FileDirectory on: filePath ].
+ 			 directory
+ 				entryAt: filename
+ 				ifAbsent: [ nil ] ]!
- 		to: [:filePath :name |
- 			fName := name.
- 			dir := filePath isEmpty
- 					ifTrue: [self]
- 					ifFalse: [FileDirectory on: filePath]].
- 
- 	^dir exists ifTrue: [dir directoryEntryForName: fName]!

Item was added:
+ ----- Method: String>>asDirectoryEntry (in category '*files') -----
+ asDirectoryEntry
+ 	^ FileDirectory directoryEntryFor: self!



More information about the Squeak-dev mailing list