[squeak-dev] Re: FileDirectory from a relative path
Miguel Enrique Cobá Martinez
miguel.coba at gmail.com
Thu Sep 17 06:07:16 UTC 2009
El mié, 16-09-2009 a las 22:49 -0700, Randal L. Schwartz escribió:
> >>>>> "Miguel" == Miguel Enrique Cobá Martinez <miguel.coba at gmail.com> writes:
>
> Miguel> Thanks Andreas, but this line outputs a string with the resolved
> Miguel> absolute path. That is ok but not what I need. I need a FileDirectory
> Miguel> object built from a string containing a relative unix path.
>
> The *real* question is are you dealing with abstract paths, or real
> disks that might have symlinks.
>
> The problem comes about when you ask to reduce:
>
> /xxx/yyy/../zzz
>
> for which, if "yyy" was made with "ln -s /aaa/bbb /xxx/yyy",
> then the proper answer is:
>
> /aaa/zzz
>
> Yeah. You can't just look at the text of the string to reduce it. You have
> to ask the operating system where the heck you are.
>
> So again, are you dealing with abstract paths that will *never* go near
> a filesystem, or are you dealing with an *actual* filesystem? And
> answer carefully, for if you answer wrong, you will be burned.
>
Good points.
I didn't think about those factors. I just have a setup like this:
dirA
|-->dirB/squeak.image
|-->dirC/directory
and from squeak.image wanted to pass a FileDirectory parameter to a
method using the relative path:
'../dirC/directory'
and not having the image a hardcoded path to the dirC/directory.
The lines that I found, and also the line that Andreas provided both
work. It is just that I wanted to know if there were a shorter, more
concise way, something along the lines:
FileDirectory on: '../dirC/directory/'.
But hey, the code works, it is just two lines instead of one.
Thanks
--
Miguel Cobá
http://miguel.leugim.com.mx
More information about the Squeak-dev
mailing list
|