lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

In message <> you wrote:

> Hello,
> 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 (
Home page: