Suggestion regarding AbsoluteFileLocator>>localFileSpecFor:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Suggestion regarding AbsoluteFileLocator>>localFileSpecFor:

Bernhard Kohlhaas-2
Hello,

Perhaps this is a case of mismatched expectations or using a class for
something it wasn't designed to do in the first place, but the current
implementation of AbsoluteFileLocator>>localFileSpecFor:
(which just returns the fileName argument) has a problem in my use case.

It works of course correctly, in the case that seems to be commonly
used,  that is to start with method #relativePathTo: to convert a file
name to  something which is storable in an image and only call
#localFileSpecFor: with an object, that is a result of a
#relativePathTo: method call.

However I'd like to use the FileLocator subhierarchy for something
(potentially) different, that is just use the #localFileSpecFor: method
to map relative path names into absolute path names and the FileLocator
instance describing the mapping strategy.

However if I use an AbsoluteFileLocator that way, I won't get an
absolute path name from method #localFileSpecFor: if I call it with
a relative path name.

Therefore I propose that the method
AbsoluteFileLocator>>localFileSpecFor: should be changed to something
like this:

        localFileSpecFor: aStringFilename
        "Answer a filespec for aStringFilename"

                ^File fullPathOf: aStringFilename


thus ensuring that the result is always an absolute path.

Best Regards,
Bernhard