Cross-platform path specification (was RE: Access directory
relatively)
Karl Ramberg
karl.ramberg at chello.se
Tue Aug 6 14:47:50 UTC 2002
Andreas Raab wrote:
>
> > >Questions:
> > > * Does this work properly cross-platform?
> >
> > It should, as long you don´t hardcode a pathNameDelimiter
>
> That actually reminds me of something - I had to use relative paths
> lately in cross-platform ways and the current way of [not] dealing with
> it really sucks. So here's a proposal for introducing FileDirectory>>,
> for referencing either files or directories. E.g., in order to get a
> directory 'foo/bar/baz' you'd write:
>
> dir := FileDirectory default, 'foo', 'bar', 'baz'.
>
> To get the file 'foo/bar/baz/mumble.file' you would say:
>
> file := FileDirectory default, 'foo', 'bar', 'baz', 'mumble.file'.
>
> The returned file would be closed so you'd have to open it through:
>
> file open: #readOnly.
> file open: #readWrite.
>
> Feelings?
>
> BTW, I had considered using '/' but it looks kinda ugly to write
> FileDirectory default / 'foo' / 'bar' / 'baz'.
> comma is already a concatenation operator and makes the cross-platform
> aspect a little clearer.
Not having spent much time thinking about this (duck)
is to have the file path to behave like a collection and write it
like {'foo'. 'bar'. 'baz'. 'mumble.file'}
Karl
More information about the Squeak-dev
mailing list
|