The Trunk: Files-cmm.149.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.149.mcz

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

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

Name: Files-cmm.149
Author: cmm
Time: 25 February 2016, 11:02:08.954431 am
UUID: ddb4a999-0151-401d-8506-8f45bc69c3ad
Ancestors: Files-topa.148

- API compatibility for #asDirectoryEntry with DirectoryEntry.
- Check for existence of a directory of same name (not just a file) when renaming a file or directory.

=============== Diff against Files-topa.148 ===============

Item was added:
+ ----- Method: DirectoryEntry>>asDirectoryEntry (in category 'converting') -----
+ asDirectoryEntry
+ ^ self!

Item was changed:
  ----- Method: FileDirectory>>rename:toBe: (in category 'file operations') -----
  rename: oldFileName toBe: newFileName
  "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"
  | replaceIt oldName newName |
  oldName := self fullNameFor: oldFileName.
  newName := self fullNameFor: newFileName.
+ ((self fileExists: oldFileName) or: [ (self directoryExists: oldFileName) ]) ifFalse: [ ^ self error: 'Attempt to rename a non-existent file or directory.' ].
- (self fileExists: oldFileName) ifFalse: [ ^ self error: 'Attempt to rename a non-existent file' ].
  (self fileExists: newFileName) ifTrue:
  [replaceIt := (ReplaceExistingFileException fileName: newFileName) signal.
  replaceIt ifTrue: [ self deleteFileNamed: newFileName ] ifFalse: [ ^ self ]].
+ (self directoryExists: newFileName) ifTrue: [ FileExistsException signal: newFileName, ' already exists.' ].
  (StandardFileStream
  retryWithGC:
  [ self
  primRename: oldName asVmPathName
  to: newName asVmPathName ]
  until: [ : result | result notNil ]
  forFileNamed: oldName) ~~ nil ifTrue: [ ^ self ].
  ^ self error: 'Failed to rename file'!