[Pkg] The Trunk: Files-eem.116.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jan 27 21:40:27 UTC 2012

Eliot Miranda uploaded a new version of Files to project The Trunk:

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

Name: Files-eem.116
Author: eem
Time: 27 January 2012, 1:40:14.298 pm
UUID: 7d927cda-c15f-4700-81bc-65cec58c3a02
Ancestors: Files-eem.115

Provide FileDirectory>relativeNameIfAbsoluteFor:,
which does what I expect relativeNameFor: to do.

=============== Diff against Files-eem.115 ===============

Item was added:
+ ----- Method: FileDirectory>>relativeNameIfAbsoluteFor: (in category 'file name utilities') -----
+ 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 pathNameDelimiter]) 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