Grease - get image directory

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

Grease - get image directory

fstephany
Hi,

GRPlatform has two methods: filesIn:aPathString and
directoriesIn:aPathString. They return the absolute paths of the
contained files.

However I do not see any (portable) way to know the image directory.

I think it is sometimes needed, for example:
GRPlatform current directoriesIn: 'bootstrap'

(where bootstrap is a directory next to my Pharo image). Gives me all
the absolute path of the directories lying in <image directory>/bootstrap

How can I get the relative path of these directories compared to the
'bootstrap' directory?

Cheers,
Francois
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Grease - get image directory

Philippe Marschall
Am 14. März 2012 05:40 schrieb Francois Stephany <[hidden email]>:

> Hi,
>
> GRPlatform has two methods: filesIn:aPathString and
> directoriesIn:aPathString. They return the absolute paths of the contained
> files.
>
> However I do not see any (portable) way to know the image directory.
>
> I think it is sometimes needed, for example:
> GRPlatform current directoriesIn: 'bootstrap'
>
> (where bootstrap is a directory next to my Pharo image). Gives me all the
> absolute path of the directories lying in <image directory>/bootstrap
>
> How can I get the relative path of these directories compared to the
> 'bootstrap' directory?

Does it have to be portable?

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Grease - get image directory

Boris Popov, DeepCove Labs (SNN)
In reply to this post by fstephany
I had to do something similar in VisualWorks, I doubt there will be a portable version, but you can certainly go via GRPlatform and implement removal of leading filename components to end up with a relative path for your resources, say,

String streamContents:
                [:ws |
                | components |
                components := filename components.
                (components last: components size - root)
                        do: [:comp | ws nextPutAll: comp]
                        separatedBy: [ws nextPut: $/]]

-Boris


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Francois Stephany
Sent: Wednesday, March 14, 2012 12:41 AM
To: [hidden email]
Subject: [Seaside] Grease - get image directory

Hi,

GRPlatform has two methods: filesIn:aPathString and directoriesIn:aPathString. They return the absolute paths of the contained files.

However I do not see any (portable) way to know the image directory.

I think it is sometimes needed, for example:
GRPlatform current directoriesIn: 'bootstrap'

(where bootstrap is a directory next to my Pharo image). Gives me all the absolute path of the directories lying in <image directory>/bootstrap

How can I get the relative path of these directories compared to the 'bootstrap' directory?

Cheers,
Francois
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Grease - get image directory

fstephany
In reply to this post by Philippe Marschall
On 14/03/12 01:33, Philippe Marschall wrote:

> Am 14. März 2012 05:40 schrieb Francois Stephany<[hidden email]>:
>> Hi,
>>
>> GRPlatform has two methods: filesIn:aPathString and
>> directoriesIn:aPathString. They return the absolute paths of the contained
>> files.
>>
>> However I do not see any (portable) way to know the image directory.
>>
>> I think it is sometimes needed, for example:
>> GRPlatform current directoriesIn: 'bootstrap'
>>
>> (where bootstrap is a directory next to my Pharo image). Gives me all the
>> absolute path of the directories lying in<image directory>/bootstrap
>>
>> How can I get the relative path of these directories compared to the
>> 'bootstrap' directory?
>
> Does it have to be portable?

That would be great. It's actually for this:
http://code.google.com/p/seaside/issues/detail?id=267
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Grease - get image directory

Dale Henrichs
It definitely would be convenient if Grease did have something like a imageHome method that returned a path string to the imageHome directory ...

Dale

----- Original Message -----
| From: "Francois Stephany" <[hidden email]>
| To: [hidden email]
| Sent: Wednesday, March 14, 2012 8:41:46 AM
| Subject: Re: [Seaside] Grease - get image directory
|
| On 14/03/12 01:33, Philippe Marschall wrote:
| > Am 14. März 2012 05:40 schrieb Francois
| > Stephany<[hidden email]>:
| >> Hi,
| >>
| >> GRPlatform has two methods: filesIn:aPathString and
| >> directoriesIn:aPathString. They return the absolute paths of the
| >> contained
| >> files.
| >>
| >> However I do not see any (portable) way to know the image
| >> directory.
| >>
| >> I think it is sometimes needed, for example:
| >> GRPlatform current directoriesIn: 'bootstrap'
| >>
| >> (where bootstrap is a directory next to my Pharo image). Gives me
| >> all the
| >> absolute path of the directories lying in<image
| >> directory>/bootstrap
| >>
| >> How can I get the relative path of these directories compared to
| >> the
| >> 'bootstrap' directory?
| >
| > Does it have to be portable?
|
| That would be great. It's actually for this:
| http://code.google.com/p/seaside/issues/detail?id=267
| _______________________________________________
| seaside mailing list
| [hidden email]
| http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
|
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Grease - get image directory

fstephany
Does that make sense in all the dialects ? (I dont know nothing about
Gemstone/VA/GNU)

On 14/03/12 09:38, Dale Henrichs wrote:

> It definitely would be convenient if Grease did have something like a imageHome method that returned a path string to the imageHome directory ...
>
> Dale
>
> ----- Original Message -----
> | From: "Francois Stephany"<[hidden email]>
> | To: [hidden email]
> | Sent: Wednesday, March 14, 2012 8:41:46 AM
> | Subject: Re: [Seaside] Grease - get image directory
> |
> | On 14/03/12 01:33, Philippe Marschall wrote:
> |>  Am 14. März 2012 05:40 schrieb Francois
> |>  Stephany<[hidden email]>:
> |>>  Hi,
> |>>
> |>>  GRPlatform has two methods: filesIn:aPathString and
> |>>  directoriesIn:aPathString. They return the absolute paths of the
> |>>  contained
> |>>  files.
> |>>
> |>>  However I do not see any (portable) way to know the image
> |>>  directory.
> |>>
> |>>  I think it is sometimes needed, for example:
> |>>  GRPlatform current directoriesIn: 'bootstrap'
> |>>
> |>>  (where bootstrap is a directory next to my Pharo image). Gives me
> |>>  all the
> |>>  absolute path of the directories lying in<image
> |>>  directory>/bootstrap
> |>>
> |>>  How can I get the relative path of these directories compared to
> |>>  the
> |>>  'bootstrap' directory?
> |>
> |>  Does it have to be portable?
> |
> | That would be great. It's actually for this:
> | http://code.google.com/p/seaside/issues/detail?id=267
> | _______________________________________________
> | seaside mailing list
> | [hidden email]
> | http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> |
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

--
http://tulipemoutarde.be
CA: +1 778 558 3225
BE: +32 65 709 131
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Grease - get image directory

Dale Henrichs
It's a bit more complicated for GemStone, as GemStone/S doesn't have an image, but the there is an equivalent interpretation.

I would think that perhaps a better notion is to define something like smalltalkRoot or smalltalkHome that has platform-specific defaults, but can be overridden at the image level...

Something like this is required for handling disk-based assets in a generic manner ...

Dale

----- Original Message -----
| From: "Francois Stephany" <[hidden email]>
| To: [hidden email]
| Sent: Wednesday, March 14, 2012 11:24:18 AM
| Subject: Re: [Seaside] Grease - get image directory
|
| Does that make sense in all the dialects ? (I dont know nothing about
| Gemstone/VA/GNU)
|
| On 14/03/12 09:38, Dale Henrichs wrote:
| > It definitely would be convenient if Grease did have something like
| > a imageHome method that returned a path string to the imageHome
| > directory ...
| >
| > Dale
| >
| > ----- Original Message -----
| > | From: "Francois Stephany"<[hidden email]>
| > | To: [hidden email]
| > | Sent: Wednesday, March 14, 2012 8:41:46 AM
| > | Subject: Re: [Seaside] Grease - get image directory
| > |
| > | On 14/03/12 01:33, Philippe Marschall wrote:
| > |>  Am 14. März 2012 05:40 schrieb Francois
| > |>  Stephany<[hidden email]>:
| > |>>  Hi,
| > |>>
| > |>>  GRPlatform has two methods: filesIn:aPathString and
| > |>>  directoriesIn:aPathString. They return the absolute paths of
| > |>>  the
| > |>>  contained
| > |>>  files.
| > |>>
| > |>>  However I do not see any (portable) way to know the image
| > |>>  directory.
| > |>>
| > |>>  I think it is sometimes needed, for example:
| > |>>  GRPlatform current directoriesIn: 'bootstrap'
| > |>>
| > |>>  (where bootstrap is a directory next to my Pharo image). Gives
| > |>>  me
| > |>>  all the
| > |>>  absolute path of the directories lying in<image
| > |>>  directory>/bootstrap
| > |>>
| > |>>  How can I get the relative path of these directories compared
| > |>>  to
| > |>>  the
| > |>>  'bootstrap' directory?
| > |>
| > |>  Does it have to be portable?
| > |
| > | That would be great. It's actually for this:
| > | http://code.google.com/p/seaside/issues/detail?id=267
| > | _______________________________________________
| > | seaside mailing list
| > | [hidden email]
| > | http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
| > |
| > _______________________________________________
| > seaside mailing list
| > [hidden email]
| > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
|
| --
| http://tulipemoutarde.be
| CA: +1 778 558 3225
| BE: +32 65 709 131
| _______________________________________________
| seaside mailing list
| [hidden email]
| http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
|
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Grease - get image directory

Philippe Marschall
In reply to this post by fstephany
Am 14. März 2012 16:41 schrieb Francois Stephany <[hidden email]>:

> On 14/03/12 01:33, Philippe Marschall wrote:
>>
>> Am 14. März 2012 05:40 schrieb Francois
>> Stephany<[hidden email]>:
>>>
>>> Hi,
>>>
>>> GRPlatform has two methods: filesIn:aPathString and
>>> directoriesIn:aPathString. They return the absolute paths of the
>>> contained
>>> files.
>>>
>>> However I do not see any (portable) way to know the image directory.
>>>
>>> I think it is sometimes needed, for example:
>>> GRPlatform current directoriesIn: 'bootstrap'
>>>
>>> (where bootstrap is a directory next to my Pharo image). Gives me all the
>>> absolute path of the directories lying in<image directory>/bootstrap
>>>
>>> How can I get the relative path of these directories compared to the
>>> 'bootstrap' directory?
>>
>>
>> Does it have to be portable?
>
>
> That would be great. It's actually for this:
> http://code.google.com/p/seaside/issues/detail?id=267

I don't want to sound too negative. The file support intentionally has
a very narrow focus: only what file library needs. The reason for this
is that we don't want Grease to be a portable file framework. SPort is
the place to look for if you need something like this, or maybe
filesystem.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside