FileSystem Question

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

FileSystem Question

Sven Van Caekenberghe-2
Hi,

Does anyone know how I can/should concatenate 2 FileReference paths ?

Given /tmp/my-cache and a/b/data.txt I want to get /tmp/my-cache/a/b/data.txt in such a way that it is a correct, useable path. Next I want to do #ensureDirectory on the parent and write to the file.

'/tmp/my-cache' asFileReference / 'a/b/data.txt' asFileReference

does not work.

'/tmp/my-cache' asFileReference / 'a/b/data.txt'

works but is wrong internally.

I can't figure out the semantics of #,

TIA,

Sven
Reply | Threaded
Open this post in threaded view
|

Re: FileSystem Question

Sven Van Caekenberghe-2
Apparently it is #resolve:

'/tmp/data-dir/' asFileReference resolve: 'a/b/c/file.txt' asFileReference

Way too many methods on the public classes of FileSystem are undocumented.

On 21 Jun 2013, at 16:31, Sven Van Caekenberghe <[hidden email]> wrote:

> Hi,
>
> Does anyone know how I can/should concatenate 2 FileReference paths ?
>
> Given /tmp/my-cache and a/b/data.txt I want to get /tmp/my-cache/a/b/data.txt in such a way that it is a correct, useable path. Next I want to do #ensureDirectory on the parent and write to the file.
>
> '/tmp/my-cache' asFileReference / 'a/b/data.txt' asFileReference
>
> does not work.
>
> '/tmp/my-cache' asFileReference / 'a/b/data.txt'
>
> works but is wrong internally.
>
> I can't figure out the semantics of #,
>
> TIA,
>
> Sven


Reply | Threaded
Open this post in threaded view
|

Re: FileSystem Question

Sean P. DeNigris
Administrator
Sven Van Caekenberghe-2 wrote
Apparently it is #resolve:
...
Way too many methods on the public classes of FileSystem are undocumented.
Will you be adding that one? ;)
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: FileSystem Question

Stéphane Ducasse
In reply to this post by Sven Van Caekenberghe-2
I did my best to comment what I could really understand.
Now as soon as somebody understand more he should have the reflex to add comments.

I was always confused by resolve:

Stef

> Apparently it is #resolve:
>
> '/tmp/data-dir/' asFileReference resolve: 'a/b/c/file.txt' asFileReference
>
> Way too many methods on the public classes of FileSystem are undocumented.
>
> On 21 Jun 2013, at 16:31, Sven Van Caekenberghe <[hidden email]> wrote:
>
>> Hi,
>>
>> Does anyone know how I can/should concatenate 2 FileReference paths ?
>>
>> Given /tmp/my-cache and a/b/data.txt I want to get /tmp/my-cache/a/b/data.txt in such a way that it is a correct, useable path. Next I want to do #ensureDirectory on the parent and write to the file.
>>
>> '/tmp/my-cache' asFileReference / 'a/b/data.txt' asFileReference
>>
>> does not work.
>>
>> '/tmp/my-cache' asFileReference / 'a/b/data.txt'
>>
>> works but is wrong internally.
>>
>> I can't figure out the semantics of #,
>>
>> TIA,
>>
>> Sven
>
>


Reply | Threaded
Open this post in threaded view
|

Re: FileSystem Question

Sven Van Caekenberghe-2
I know you did, but it is as you say: this should be done by someone who really understands the design. For example: I learned about #resolve: from comments at the Disk implementation level, not the Public API level where there are almost no commennts. I got into several loops using wrong methods, those should have been marked private I would guess.

On 21 Jun 2013, at 22:58, Stéphane Ducasse <[hidden email]> wrote:

> I did my best to comment what I could really understand.
> Now as soon as somebody understand more he should have the reflex to add comments.
>
> I was always confused by resolve:
>
> Stef
>> Apparently it is #resolve:
>>
>> '/tmp/data-dir/' asFileReference resolve: 'a/b/c/file.txt' asFileReference
>>
>> Way too many methods on the public classes of FileSystem are undocumented.
>>
>> On 21 Jun 2013, at 16:31, Sven Van Caekenberghe <[hidden email]> wrote:
>>
>>> Hi,
>>>
>>> Does anyone know how I can/should concatenate 2 FileReference paths ?
>>>
>>> Given /tmp/my-cache and a/b/data.txt I want to get /tmp/my-cache/a/b/data.txt in such a way that it is a correct, useable path. Next I want to do #ensureDirectory on the parent and write to the file.
>>>
>>> '/tmp/my-cache' asFileReference / 'a/b/data.txt' asFileReference
>>>
>>> does not work.
>>>
>>> '/tmp/my-cache' asFileReference / 'a/b/data.txt'
>>>
>>> works but is wrong internally.
>>>
>>> I can't figure out the semantics of #,
>>>
>>> TIA,
>>>
>>> Sven
>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: FileSystem Question

Stéphane Ducasse

On Jun 21, 2013, at 11:01 PM, Sven Van Caekenberghe <[hidden email]> wrote:

> I know you did, but it is as you say: this should be done by someone who really understands the design. For example: I learned about #resolve: from comments at the Disk implementation level, not the Public API level where there are almost no commennts. I got into several loops using wrong methods, those should have been marked private I would guess.

I know this is sad but this is the case with most of the code of colin.
I did my best to add comments but guessing is always more error prone and stupid trial and error.
Anyway we will improve slowly.

I do not understand why writing simple method comments is difficult to do when you write the code of the methods.

Stef