Hi guys
(FileSystem workingDirectory / 'book-result' / 'W01-Welcome') relativeToReference: FileSystem workingDirectory >>> Path * 'book-result' / 'W01-Welcome' And I would like to get 'book-result/W01-Welcome' I tried all kind of combination and the lack of comments (Yes I know I added the ones there is not helping). Stef |
Hi Stef,
On Sun, Jun 18, 2017 at 05:54:08PM +0200, Stephane Ducasse wrote: > Hi guys > > (FileSystem workingDirectory / 'book-result' / 'W01-Welcome') > relativeToReference: FileSystem workingDirectory > >>> Path * 'book-result' / 'W01-Welcome' > > And I would like to get 'book-result/W01-Welcome' > > I tried all kind of combination and the lack of comments (Yes I know I > added the ones there > is not helping). > > Stef DiskStore current stringFromPath: ((FileSystem workingDirectory / 'book-result' / 'W01-Welcome') relativeToReference: FileSystem workingDirectory) will return the string you want. But I would argue that Path>>fullName is incorrectly implemented and should actually be: fullName "Answer the string representation of the receiver" ^self delimiter join: self segments Cheers, Alistair |
Hi alistair
Thanks alistair. It looks to me that there is something missing because the printOn: is producing this. Relying on DiskStore current stringFromPath: looks ugly to me. https://pharo.fogbugz.com/f/cases/20165/Support-segment-path-printing So I propose to add Path >> printPathOn: aStream delimiter: aCharacter "Print the path elements of the receiver, without the 'Path *' part" "String streamContents: [ :str| ((FileSystem workingDirectory / 'book-result' / 'W01-Welcome') relativeToReference: FileSystem workingDirectory) printPathOn: str] >>> 'book-result/W01-Welcome'" (1 to: self size) do: [:index | aStream nextPutAll: (self at: index)] separatedBy: [aStream nextPut: aCharacter] printPathOn: aStream "Print the path elements of the receiver, without the 'Path *' part" "String streamContents: [ :str| ((FileSystem workingDirectory / 'book-result' / 'W01-Welcome') relativeToReference: FileSystem workingDirectory) printPathOn: str] >>> 'book-result/W01-Welcome'" self printPathOn: aStream delimiter: self delimiter pathString "Return a string containing the path elements of the receiver, without the 'Path *' part" " ((FileSystem workingDirectory / 'book-result' / 'W01-Welcome') relativeToReference: FileSystem workingDirectory) pathString >>> 'book-result/W01-Welcome'" ^ String streamContents: [ :str| self printPathOn: str delimiter: self delimiter ] tell me what you think? On Sun, Jun 18, 2017 at 6:05 PM, Alistair Grant <[hidden email]> wrote: > Hi Stef, > > On Sun, Jun 18, 2017 at 05:54:08PM +0200, Stephane Ducasse wrote: >> Hi guys >> >> (FileSystem workingDirectory / 'book-result' / 'W01-Welcome') >> relativeToReference: FileSystem workingDirectory >> >>> Path * 'book-result' / 'W01-Welcome' >> >> And I would like to get 'book-result/W01-Welcome' >> >> I tried all kind of combination and the lack of comments (Yes I know I >> added the ones there >> is not helping). >> >> Stef > > DiskStore current stringFromPath: > ((FileSystem workingDirectory / 'book-result' / 'W01-Welcome') > relativeToReference: FileSystem workingDirectory) > > will return the string you want. > > But I would argue that Path>>fullName is incorrectly implemented and > should actually be: > > fullName > "Answer the string representation of the receiver" > > ^self delimiter join: self segments > > > Cheers, > Alistair > > |
Free forum by Nabble | Edit this page |