-
Notifications
You must be signed in to change notification settings - Fork 61
Description
@Ducasse and I ran into a peculiar error today, not sure if the problem is mine or yours :-)
The situation an absolute path, for example '/Users/kasper/tmp'.
Assuming the directory tmp exist, I get '/Users/kasper/tmp' asFileReference isDirectory to be true.
However, '/Users/kasper/tmp' asFileReference asZnUrl isDirectoryPath returns false.
The reason for the difference is that the implementation of asZnUrl for file references are based on paths
AbstractFilePath>>asZnUrl
^ self asAbsolute path asZnUrlBasing the implementation on the path looses the information that '/Users/kasper/tmp' is a directory.
We have a chokepoint in our code which will allow us to encapsulate this, so we can work around our specific problem. But the question is if the implementation above should really be:
AbstractFilePath>>asZnUrl
^ self isDirectory
ifTrue: [ ('file:',self pathString , '/') asZnUrl ]
ifFalse: [ self asAbsolute path asZnUrl ]I am sure you know a better implementation, but this seems to work - that is '/Users/kasper/tmp' asFileReference asZnUrl isDirectoryPath returns true