[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: directory separator?
- From: Gavin Wraith <gavin@...>
- Date: Wed, 12 Jul 2006 13:55:09 +0100
In message <email@example.com> you wrote:
> What would be a reasonable way to guess the directory separator
> (e.g. / or \) from a Lua script?
> Presently, I'm parsing the package.path, but perhaps there is a more
> reliable way to achieve this?
> print( package.path:match( "(%p)%?%." ) )
> > /
> I noticed a LUA_DIRSEP in luaconf.h. Is that accessible from a Lua
> script? Some of this information seems to be pushed into
> package.config by loadlib.c:
I think any kind of attempt at a generic filing syntax for all
systems could be complicated. RISC OS uses '.' for
directory separator and '$' for the root directory, but a
canonicalized pathname must also contain a prefix specifying
the filing system and medium title. So Mem::Memphis.$.Scrap.Mytext
(Mem is a RAMDisc filing system) will be different from
ADFS::Iyonix.$.Scrap.Mytext (ADFS is a hard disc filing system),
though both could be described as /Scrap/Mytext from
the Unix filenaming point of view. In theory users can write
their own filing systems, using their own syntactic preferences.
Finding even an abstract syntax to cover all eventualities
sounds dodgy to me.
Gavin Wraith (firstname.lastname@example.org)
Home page: http://www.wra1th.plus.com/