Re: [Pharo-users] FileReference basename of current dir

2017-11-15 Thread Alistair Grant
Hi Guille,

On 15 November 2017 at 10:39, Guillermo Polito
 wrote:
>
> Made a small review ;)

Good idea.  I've updated the PR.

Thanks,
Alistair


> On Wed, Nov 15, 2017 at 10:34 AM, Alistair Grant  
> wrote:
>>
>> On 14 November 2017 at 22:36, Alistair Grant  wrote:
>> > On 10 November 2017 at 22:30, Alistair Grant  wrote:
>> >> On 9 November 2017 at 22:12, Norbert Hartl  wrote:
>> >>> is there a good explanation why
>> >>>
>> >>> ‚foo‘ asFileReference parent basename
>> >>>
>> >>> gives ‚/‘ ?
>> >>
>> >> I'd like to think about this a bit more, but at first glance the
>> >> problem seems to be that Path>>basename was written only taking
>> >> Absolute paths in to consideration.
>> >>
>> >> So RelativePath>>basename needs to be added:
>> >>
>> >> basename
>> >> "Returns the base of the basename,
>> >> i.e.
>> >> foo/gloops.taz basename is 'gloops.taz'
>> >> . basename is '.'"
>> >> self size == 0
>> >> "the current directory"
>> >> ifTrue: [ ^ '.'].
>> >> ^ self at: self size
>> >
>> > Fogbugz 20693: 
>> > https://pharo.fogbugz.com/f/cases/20693/Incorrect-basename-of-empty-relative-path
>> >
>> > I've got the code changes done, but am having troubles with Iceberg
>> > (which I'll post about if I can't get it working).
>>
>> PR #481 submitted (the Iceberg problems were pre-keyboard :-))
>>
>> Thanks,
>> Alistair
>>
>
>
>
> --
>
>
>
> Guille Polito
>
> Research Engineer
>
> Centre de Recherche en Informatique, Signal et Automatique de Lille
>
> CRIStAL - UMR 9189
>
> French National Center for Scientific Research - http://www.cnrs.fr
>
>
> Web: http://guillep.github.io
>
> Phone: +33 06 52 70 66 13



Re: [Pharo-users] FileReference basename of current dir

2017-11-15 Thread Guillermo Polito
Made a small review ;)

On Wed, Nov 15, 2017 at 10:34 AM, Alistair Grant 
wrote:

> On 14 November 2017 at 22:36, Alistair Grant 
> wrote:
> > On 10 November 2017 at 22:30, Alistair Grant 
> wrote:
> >> On 9 November 2017 at 22:12, Norbert Hartl  wrote:
> >>> is there a good explanation why
> >>>
> >>> ‚foo‘ asFileReference parent basename
> >>>
> >>> gives ‚/‘ ?
> >>
> >> I'd like to think about this a bit more, but at first glance the
> >> problem seems to be that Path>>basename was written only taking
> >> Absolute paths in to consideration.
> >>
> >> So RelativePath>>basename needs to be added:
> >>
> >> basename
> >> "Returns the base of the basename,
> >> i.e.
> >> foo/gloops.taz basename is 'gloops.taz'
> >> . basename is '.'"
> >> self size == 0
> >> "the current directory"
> >> ifTrue: [ ^ '.'].
> >> ^ self at: self size
> >
> > Fogbugz 20693: https://pharo.fogbugz.com/f/cases/20693/Incorrect-
> basename-of-empty-relative-path
> >
> > I've got the code changes done, but am having troubles with Iceberg
> > (which I'll post about if I can't get it working).
>
> PR #481 submitted (the Iceberg problems were pre-keyboard :-))
>
> Thanks,
> Alistair
>
>


-- 



Guille Polito

Research Engineer

Centre de Recherche en Informatique, Signal et Automatique de Lille

CRIStAL - UMR 9189

French National Center for Scientific Research - *http://www.cnrs.fr
*


*Web:* *http://guillep.github.io* 

*Phone: *+33 06 52 70 66 13


Re: [Pharo-users] FileReference basename of current dir

2017-11-15 Thread Alistair Grant
On 14 November 2017 at 22:36, Alistair Grant  wrote:
> On 10 November 2017 at 22:30, Alistair Grant  wrote:
>> On 9 November 2017 at 22:12, Norbert Hartl  wrote:
>>> is there a good explanation why
>>>
>>> ‚foo‘ asFileReference parent basename
>>>
>>> gives ‚/‘ ?
>>
>> I'd like to think about this a bit more, but at first glance the
>> problem seems to be that Path>>basename was written only taking
>> Absolute paths in to consideration.
>>
>> So RelativePath>>basename needs to be added:
>>
>> basename
>> "Returns the base of the basename,
>> i.e.
>> foo/gloops.taz basename is 'gloops.taz'
>> . basename is '.'"
>> self size == 0
>> "the current directory"
>> ifTrue: [ ^ '.'].
>> ^ self at: self size
>
> Fogbugz 20693: 
> https://pharo.fogbugz.com/f/cases/20693/Incorrect-basename-of-empty-relative-path
>
> I've got the code changes done, but am having troubles with Iceberg
> (which I'll post about if I can't get it working).

PR #481 submitted (the Iceberg problems were pre-keyboard :-))

Thanks,
Alistair



Re: [Pharo-users] FileReference basename of current dir

2017-11-10 Thread Alistair Grant
On 9 November 2017 at 22:12, Norbert Hartl  wrote:
> is there a good explanation why
>
> ‚foo‘ asFileReference parent basename
>
> gives ‚/‘ ?

I'd like to think about this a bit more, but at first glance the
problem seems to be that Path>>basename was written only taking
Absolute paths in to consideration.

So RelativePath>>basename needs to be added:

basename
"Returns the base of the basename,
i.e.
foo/gloops.taz basename is 'gloops.taz'
. basename is '.'"
self size == 0
"the current directory"
ifTrue: [ ^ '.'].
^ self at: self size


Cheers,
Alistair



Re: [Pharo-users] FileReference basename of current dir

2017-11-10 Thread Guillermo Polito
On Thu, Nov 9, 2017 at 10:12 PM, Norbert Hartl  wrote:

> is there a good explanation why
>
> ‚foo‘ asFileReference parent basename
>
> gives ‚/‘ ?
>

I can only answer making one of the following assumtions

- You've launched your image doing a double click
- or by doing drag and drop on a vm
- or from the command line from the root '/' directory

In any of those three cases, the operating system will assign '/' as
working directory. Thus any file created from a relative path will be
relative to it.

Check also:

'foo‘ asFileReference parent = FileSystem workingDirectory.
'foo‘ asFileReference = FileSystem workingDirectory / 'foo'.

and:

'/‘ asFileReference = FileSystem workingDirectory.


-- 



Guille Polito

Research Engineer

Centre de Recherche en Informatique, Signal et Automatique de Lille

CRIStAL - UMR 9189

French National Center for Scientific Research - *http://www.cnrs.fr
*


*Web:* *http://guillep.github.io* 

*Phone: *+33 06 52 70 66 13