Hi Stef,

Assuming I understand what you're trying to do:

This is broken out to hopefully make it clear what the steps are:

| src srcPrefix dstPrefix dst |

src := 'a/b/c/d.pi' asFileReference.
srcPrefix := 'a' asFileReference.
dstPrefix := 'result' asFileReference.
dst := dstPrefix resolve: (src relativeTo: srcPrefix).
dst


At that point presumably you want:

src copyTo: dst.


Cheers,
Alistair




On 6 February 2018 at 21:50, Stephane Ducasse <stepharo.s...@gmail.com> wrote:
> Thanks alistair
>
> What I want to know is a different of paths between two paths so that
> after I can reproduce the structure under another folder.
> Example
>
> a/b/c/d.pi
> I should ''copy'' it into result folder and I should get
>
> result/b/c/d.pi
>
> now I compute the path
>
> What is the path of a/b/c/d.pi in a => b/c/d.pi and I should then
> 'copy' to result/b/c/d.pi
>
> On Fri, Feb 2, 2018 at 11:26 PM, Alistair Grant <akgrant0...@gmail.com> wrote:
>> Hi Stef,
>>
>> On 2 February 2018 at 20:58, Stephane Ducasse <stepharo.s...@gmail.com> 
>> wrote:
>>> Then I do not get why / is expecting a string and cannot accept a path.
>>>
>>> Then I do not get why we have paths.
>>> Stef
>>
>> Paths are intended to be internal, and not something you ever deal
>> with directly.
>>
>> I'm not sure I understand what you want to do, but maybe try replacing
>> #/ with #resolve:, e.g.:
>>
>> '/home' asFileReference resolve: 'user' asFileReference
>> " File @ /home/user"
>>
>>
>> or:
>>
>> '/home' asFileReference resolve: 'user' asFileReference path
>> " File @ /home/user"
>>
>>
>> Cheers,
>> Alistair
>>
>>
>>> On Fri, Feb 2, 2018 at 8:22 PM, Stephane Ducasse
>>> <stepharo.s...@gmail.com> wrote:
>>>> HI
>>>>
>>>> I have the following scenario:
>>>>
>>>> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
>>>> asFileReference /
>>>> 'book.pillar'
>>>>
>>>>>>>
>>>>  "File @ 
>>>> /Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result/book.pillar"
>>>>
>>>> ok it works.
>>>>
>>>> I want to update the contents of a target folder only if a file is
>>>> missing or too old compared to a source.
>>>>
>>>> The idea is that I have a target folder and I need to know if a file
>>>> located in the source tree should be copied under the target.
>>>> So I compute the difference from the root of the source to the file
>>>> and I want to apply this path to the target to check some file
>>>> properties.
>>>>
>>>> now I do not understand how I can get the following working:
>>>>
>>>>  
>>>> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
>>>> asFileReference
>>>> /
>>>>
>>>>  
>>>> ('/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/book.pillar'
>>>> asFileReference path)
>>>>  relativeTo: 
>>>> ('/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo'
>>>> asFileReference path)
>>>>
>>>>
>>>> Stef
>>>
>>
>

Reply via email to