Cross-platform path specification (was RE: Access directory relatively)
Andreas Raab
Andreas.Raab at gmx.de
Mon Aug 5 20:30:09 UTC 2002
> >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.
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|