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 |
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 On Fri, Feb 2, 2018 at 8:22 PM, Stephane Ducasse <[hidden email]> 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 |
In reply to this post by Stephane Ducasse-3
Hi 2018-02-02 20:22 GMT+01:00 Stephane Ducasse <[hidden email]>: HI |
In reply to this post by Stephane Ducasse-3
Hi Stef,
On 2 February 2018 at 20:58, Stephane Ducasse <[hidden email]> 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 > <[hidden email]> 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 > |
In reply to this post by Denis Kudriashov
HI
I have the following scenario: '/PharoBooks/Booklet-AMiniSchemeInPharo/_result' asFileReference / 'book.pillar' >>> "File @ /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: '/PharoBooks/Booklet-AMiniSchemeInPharo/_result' asFileReference / ('/PharoBooks/Booklet-AMiniSchemeInPharo/book.pillar' asFileReference path) relativeTo: ('/PharoBooks/Booklet-AMiniSchemeInPharo' asFileReference path) You see relativeTo: should tells me the diff in terms of path between two paths. Stef On Fri, Feb 2, 2018 at 10:27 PM, Denis Kudriashov <[hidden email]> wrote: > Hi > > Can you provide more simple example with shorter paths? I am lost in these > long strings :). > > 2018-02-02 20:22 GMT+01:00 Stephane Ducasse <[hidden email]>: >> >> 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 >> > |
In reply to this post by alistairgrant
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 <[hidden email]> wrote: > Hi Stef, > > On 2 February 2018 at 20:58, Stephane Ducasse <[hidden email]> 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 >> <[hidden email]> 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 >> > |
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 <[hidden email]> 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 <[hidden email]> wrote: >> Hi Stef, >> >> On 2 February 2018 at 20:58, Stephane Ducasse <[hidden email]> 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 >>> <[hidden email]> 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 >>> >> > |
Tx alistair
Yes this is what I want. I tried to copy (before your post and I do not recall that copy was creating the intermediate folders). Stef On Tue, Feb 6, 2018 at 1:14 PM, Alistair Grant <[hidden email]> wrote: > 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 <[hidden email]> 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 <[hidden email]> wrote: >>> Hi Stef, >>> >>> On 2 February 2018 at 20:58, Stephane Ducasse <[hidden email]> 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 >>>> <[hidden email]> 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 >>>> >>> >> > |
Now what is the difference between / and resolve: because this is the
only difference with my code. I used path because it was the only way I could make sense. I will update the documentation :( this will be my cross. On Wed, Feb 7, 2018 at 8:28 PM, Stephane Ducasse <[hidden email]> wrote: > Tx alistair > > Yes this is what I want. > I tried to copy (before your post and I do not recall that copy was > creating the intermediate folders). > > Stef > > > On Tue, Feb 6, 2018 at 1:14 PM, Alistair Grant <[hidden email]> wrote: >> 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 <[hidden email]> 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 <[hidden email]> wrote: >>>> Hi Stef, >>>> >>>> On 2 February 2018 at 20:58, Stephane Ducasse <[hidden email]> 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 >>>>> <[hidden email]> 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 >>>>> >>>> >>> >> |
Free forum by Nabble | Edit this page |