2.4b FileDirectory>>fileExists:

Bob Arning arning at charm.net
Fri Apr 30 05:07:04 UTC 1999


A recent change to FileDirectory>>fileExists: makes the test for a given file case-sensitive. I noticed this when 2.4b couldn't find the sources file even though I had copied one from a working 2.4beta directory. Changing the name to exactly 'SqueakV2.sources' solved that. Since most (all for Squeak?) operating systems are not case-sensitive, it might be nice to retain the old behavior. Code to do so follows.

Cheers,
Bob

'From Squeak 2.4b of April 23, 1999 on 30 April 1999 at 12:53:43 am'!

!FileDirectory methodsFor: 'testing' stamp: 'RAA 4/30/1999 00:52'!
fileExists: filenameOrPath
	"Answer true if a file of the given name exists. The given name may be either a full path name or a local file within this directory."
	"FileDirectory default fileExists: Smalltalk sourcesName"

	| fName dir |
	FileDirectory splitName: filenameOrPath to:
		[:filePath :name |
			fName _ name.
			filePath isEmpty
				ifTrue: [dir _ self]
				ifFalse: [dir _ FileDirectory on: filePath]].
	fName _ fName asLowercase.
	^ (dir fileNames detect: [ :each | each asLowercase = fName ] ifNone: [nil]) notNil
! !





More information about the Squeak-dev mailing list