[Pkg] The Trunk: Files-nice.170.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Apr 26 21:01:57 UTC 2017

Nicolas Cellier uploaded a new version of Files to project The Trunk:

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

Name: Files-nice.170
Author: nice
Time: 26 April 2017, 11:01:48.184504 pm
UUID: 16f1903f-4a56-4f35-b737-dbb16a9022ae
Ancestors: Files-ul.169

Classify a few 'as yet unclassified' methods

=============== Diff against Files-ul.169 ===============

Item was changed:
+ ----- Method: DosFileDirectory>>checkName:fixErrors: (in category 'file name utilities') -----
- ----- Method: DosFileDirectory>>checkName:fixErrors: (in category 'as yet unclassified') -----
  checkName: aFileName fixErrors: fixing
  	"Check if the file name contains any invalid characters"
  	| fName badChars hasBadChars |
  	fName := super checkName: aFileName fixErrors: fixing.
  	badChars := #( $: $< $> $| $/ $\ $? $* $") asSet.
  	hasBadChars := fName includesAnyOf: badChars.
  	(hasBadChars and:[fixing not]) ifTrue:[^self error:'Invalid file name'].
  	hasBadChars ifFalse:[^ fName].
  	^ fName collect:
  		[:char | (badChars includes: char) 

Item was changed:
+ ----- Method: DosFileDirectory>>setPathName: (in category 'private') -----
- ----- Method: DosFileDirectory>>setPathName: (in category 'as yet unclassified') -----
  setPathName: pathString
  	"Ensure pathString is absolute - relative directories aren't supported on all platforms."
  	(pathString isEmpty
  		or: [pathString first = $\
  			or: [pathString size >= 2 and: [pathString second = $: and: [pathString first isLetter]]]])
  				ifTrue: [^ super setPathName: pathString].
  	self error: 'Fully qualified path expected'!

Item was changed:
+ ----- Method: InvalidDirectoryError>>defaultAction (in category 'handling') -----
- ----- Method: InvalidDirectoryError>>defaultAction (in category 'exceptionDescription') -----
  	"Return an empty list as the default action of signaling the occurance of an invalid directory."

Item was changed:
+ ----- Method: MacFileDirectory>>fullNameFor: (in category 'file name utilities') -----
- ----- Method: MacFileDirectory>>fullNameFor: (in category 'as yet unclassified') -----
  fullNameFor: fileName
  	"Return a corrected, fully-qualified name for the given file name. If the given name is already a full path (i.e., it contains a delimiter character), assume it is already a fully-qualified name. Otherwise, prefix it with the path to this directory. In either case, correct the local part of the file name."
  	"Details: Note that path relative to a directory, such as '../../foo' are disallowed by this algorithm.  Also note that this method is tolerent of a nil argument -- is simply returns nil in this case."
  	"Fix by hmm: for a file in the root directory of a volume on MacOS, the filePath (name of the directory) is not  recognizable as an absolute path anymore (it has no delimiters). Therefore, the original fileName is tested for absoluteness, and the filePath is only made absolute if the original fileName was not absolute"
  	| correctedLocalName prefix |
  	fileName isEmptyOrNil ifTrue: [^ fileName].
  	DirectoryClass splitName: fileName to:
  		[:filePath :localName |
  			correctedLocalName := localName isEmpty 
  				ifFalse: [self checkName: localName fixErrors: true]
  				ifTrue: [localName].
  			prefix := (DirectoryClass isAbsolute: fileName)
  						ifTrue: [filePath]
  						ifFalse: [self fullPathFor: filePath]].
  	prefix isEmpty
  		ifTrue: [^correctedLocalName].
  	prefix last = self pathNameDelimiter
  		ifTrue:[^ prefix, correctedLocalName]
  		ifFalse:[^ prefix, self slash, correctedLocalName]!

More information about the Packages mailing list