[Pkg] The Trunk: Files-dtl.130.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jan 22 01:13:05 UTC 2014


David T. Lewis uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-dtl.130.mcz

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

Name: Files-dtl.130
Author: dtl
Time: 21 January 2014, 8:12:33.518 pm
UUID: 8ee82071-69f7-446d-8ed7-77eafc838f03
Ancestors: Files-eem.129

Merge Files-kfr.120

Fix for test failure on Windows (FileDirectoryTest>>testRelativeNameIfAbsoluteFor)

Two notes for possible follow up:
- On Unix, a leading '/' is presumed to mean an absolute path. On Windows, we now check for a leading drive name (e.g. 'C:'). In common use this would indicate an absolute path, but I think that it is also possible to specify a drive name followed by a relative path, so someone with Windows experience should check this.
- The new DosFileDirectory>>relativeNameIfAbsoluteFor: is nearly the same (one line difference) as the method that it overrides, so some refactoring may be in order.

=============== Diff against Files-eem.129 ===============

Item was added:
+ ----- Method: DosFileDirectory>>relativeNameIfAbsoluteFor: (in category 'path access') -----
+ relativeNameIfAbsoluteFor: aFileName
+ 	"Answer either the relative name for aFileName, if aFileName names a file in me or
+ 	 subdirectories, or aFileName's absolute path if it isn't in me or subdirectories.
+ 	 P.S. Ths is what I'd expect relativeNameFor: to do, but it is taken and means
+ 	 exactly the opposite, i.e. the absolute path for a relative name."
+ 	| fullNameSize fullName fileNameSize |
+ 	(aFileName isEmpty or: [aFileName first ~= self driveName first]) ifTrue:
+ 		[self error: 'this method expects an absolute filename'].
+ 	fullNameSize := (fullName := self fullName) size.
+ 	fileNameSize := aFileName size.
+ 	^(aFileName beginsWith: fullName)
+ 		ifTrue: [(fileNameSize = fullNameSize
+ 				or: [fileNameSize - 1 = fullNameSize
+ 					and: [(aFileName at: fileNameSize) = self pathNameDelimiter]])
+ 					ifTrue: [self class currentDirectoryNickname]
+ 					ifFalse: [aFileName copyFrom: fullNameSize + 2 to: fileNameSize]]
+ 		ifFalse: [aFileName]
+ 
+ 	"SourceFiles asArray collect: [:sf| FileDirectory default relativeNameIfAbsoluteFor: sf fullName]"
+ 	"FileDirectory default relativeNameIfAbsoluteFor: FileDirectory default fullName" "should be dot"
+ 	"FileDirectory default relativeNameIfAbsoluteFor: FileDirectory default fullName, FileDirectory default slash" "should also be dot"!



More information about the Packages mailing list