about diff paths

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

about diff paths

Stephane Ducasse-3
Hi

I want to know the path from a given point in a path
for example

'/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/Chapters/Scheme.pillar'
asFileReference path
relativeToPath: (Path /
'/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/')

should give me 'Chapters/Scheme.pillar'

as in the example in the method

(Path / 'griffle' / 'plonk' / 'nurp')
   relativeToPath: (Path / 'griffle')
      returns  plonk/nurp

But I got

 Path * '..' / 'Users' / 'ducasse' / 'Workspace' / 'FirstCircle' /
'MyBooks' / 'Bk-Writing' / 'PharoBooks' / 'Booklet-AMiniSchemeInPharo'
/ 'Chapters' / 'Scheme.pillar'

and I do not understand. I can do it doing string manipulation but it defeats
the purpose to have a nice library.

Any hints?

Stef

Reply | Threaded
Open this post in threaded view
|

Re: about diff paths

Stephane Ducasse-3
'/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/Chapters/Scheme.pillar'
asFileReference path
relativeToPath:
'/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/Chapters/'
asFileReference path

In fact / should split or raise an exception.

Stef


On Fri, Feb 2, 2018 at 12:51 PM, Stephane Ducasse
<[hidden email]> wrote:

> Hi
>
> I want to know the path from a given point in a path
> for example
>
> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/Chapters/Scheme.pillar'
> asFileReference path
> relativeToPath: (Path /
> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/')
>
> should give me 'Chapters/Scheme.pillar'
>
> as in the example in the method
>
> (Path / 'griffle' / 'plonk' / 'nurp')
>    relativeToPath: (Path / 'griffle')
>       returns  plonk/nurp
>
> But I got
>
>  Path * '..' / 'Users' / 'ducasse' / 'Workspace' / 'FirstCircle' /
> 'MyBooks' / 'Bk-Writing' / 'PharoBooks' / 'Booklet-AMiniSchemeInPharo'
> / 'Chapters' / 'Scheme.pillar'
>
> and I do not understand. I can do it doing string manipulation but it defeats
> the purpose to have a nice library.
>
> Any hints?
>
> Stef