Of course I should have written UnixFileDirectory default directoryExists: UnixFileDirectory default fullName, '/.' But same problem applies... On Thu, Dec 15, 2011 at 2:19 PM, Eliot Miranda <eliot.miranda@gmail.com>wrote:
Hi All,
just noticed that
UnixFileDirectory default directoryExists: UnixFileDirectory default asString, '/.'
answers false, since directoryNames excludes '.' and '..' (justifiable, and changing this might break all manner of things). i.e.
FileDirectory>directoryExists: filenameOrPath "Answer true if a directory of the given name exists. The given name may be either a full path name or a local directory within this directory." "FileDirectory default directoryExists: FileDirectory default pathName"
| fName dir | DirectoryClass splitName: filenameOrPath to: [:filePath :name | fName := name. filePath isEmpty ifTrue: [dir := self] ifFalse: [dir := self directoryNamed: filePath]].
^dir exists and: [ self isCaseSensitive ifTrue:[dir directoryNames includes: fName] ifFalse:[dir directoryNames anySatisfy: [:name| name sameAs: fName]]].
So how about
FileDirectory class methods for accessing currentDirectoryNickname ^'.'
FileDirectory>directoryExists: filenameOrPath "Answer true if a directory of the given name exists. The given name may be either a full path name or a local directory within this directory." "FileDirectory default directoryExists: FileDirectory default pathName"
| fName dir | DirectoryClass splitName: filenameOrPath to: [:filePath :name | fName := name. filePath isEmpty ifTrue: [dir := self] ifFalse: [dir := self directoryNamed: filePath]].
^dir exists and: [fName = self class currentDirectoryNickname or: [self isCaseSensitive ifTrue:[dir directoryNames includes: fName] ifFalse:[dir directoryNames anySatisfy: [:name| name sameAs: fName]]]]
-- best, Eliot
-- best, Eliot