The Trunk: Files-cmm.131.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Files-cmm.131.mcz

commits-2
Chris Muller uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/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!