Login  Register

Re: About file printOn: method

Posted by Udo Schneider on Sep 09, 2016; 6:18pm
URL: https://forum.world.st/About-file-printOn-method-tp4913939p4915018.html

I'm a bit biased on this. IMHO this simplification in the #printString
(which I quite like BTW!) is only applicable to Files in DiskFileSystem.

If you have a FileReference on a non disk filesystem (e.g.

        fr1 := FileSystem memory root / 'folder' / 'test.txt'.
        "memory:///folder/test.txt"

on use this simplified #printString you'll end up with

        '/folder/test.txt' asFileReference.

This might be confusing as this does not mention the filesystem. So you
might end up creating a new instance via

        fr2 := '/folder/test.txt' asFileReference.

which is not equal to the original fileRef:

        fr1 = fr2 "false"

As I do like the #printString simplification ... why not simply adopt a
URI style scheme for FileReferences. This would allow encoding the
filesystem type (e.g. file://, memory://, zip://, s3://) including
parameters like host if needed and of course the path.

CU,

Udo



On 04/09/16 09:47, stepharo wrote:

> It is raining and I will do it :)
>
>
> stef
>
>
> Le 4/9/16 à 02:38, monty a écrit :
>> +1
>>
>>> Sent: Saturday, September 03, 2016 at 10:39 AM
>>> From: stepharo <[hidden email]>
>>> To: "Pharo Development List"
>>> <[hidden email]>
>>> Subject: [Pharo-dev] About file printOn: method
>>>
>>> Hi
>>>
>>>
>>> I will implement the following because this is too annoying.
>>>
>>> currently
>>>
>>> 'tmp/foo.txt' asFileReference
>>>   >
>>> File @ tmp/foo.txt
>>>
>>> and it would be much much better to get back
>>> 'tmp/foo.txt' asFileReference
>>>
>>> So that we can get
>>> { 'tmp/foo.txt' asFileReference }
>>>   > { 'tmp/foo.txt' asFileReference }
>>>
>>> and not
>>>    "an Array(File @ tmp/foo.txt)"
>>>
>>>
>>> In addition we should turn the current printOn: method into a
>>> displayString method so that
>>> a list of fileReference can be well display with File @ tmp/foo.txt for
>>> example
>>>
>>>
>>> https://pharo.fogbugz.com/f/cases/18956
>>>
>>>
>>>
>>
>
>
>