[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Detect Windows reliably (was: io.popen binary write compatibility)
- From: Dirk Laurie <dirk.laurie@...>
- Date: Fri, 26 Sep 2014 16:49:10 +0200
package.config
A string describing some compile-time configurations for packages.
This string is a sequence of lines:
The first line is the directory separator string. Default is '\' for
Windows and '/' for all other systems.
2014-09-26 10:06 GMT+02:00 Enrico Colombini <erix@erix.it>:
> Does anybody have a recipe for recognizing that a Lua program is being
> executed under Windows?
>
> Reading the "OS" environment variable does not work before Windows NT (I'm a
> perfectionist...).
>
> I could open a file in 'w' mode, write a newline, close the file, read it
> back in 'wb' mode and check for \r\n. Requires write access, however.
>
> Hmm... maybe I could check if arg[-1] starts with '%a%:' and/or if it
> contains a backslash. Would that be reliable?
>
> --
> Enrico
>