R
Ronald Fischer
My application deals with pathlists similar to what we know from PATH,=20
LD_LIBRARY_PATH and so on, and is intended to run under Windows, Cygwin,
and Linux/Unix type of systems. Example:
On Windows:
set MY_SEARCH_PATH=3DC:\LIB1;D:\LIB2
On Linux:
export MY_SEARCH_PATH=3D/usr/lib/LIB1:$HOME/LIB2
Of course this means that if in order to decompose a pathlist, I need to
know whether to split on ';' (for Windows) or on ':' (for the rest of
the=20
world). How can I most easily decide at runtime, what "style" of system=20
I am running?
I found the constant RUBY_PLATFORM, but it is a bit too specific,
returning
things like "i386-mswin32" for my Windows.
How do other people deal with this problem? Do you consider it safe to
assume
- "Cygwin" when RUBY_PLATFORM=3D=3D'cygwin', else
- "Windows" style path when RUBY_PLATFORM =3D~ /win/i
- "Unix" style path otherwise?
I am aware that there is likely no solution which is 100% waterproof,
but
I am happy when I find one which is reasonably stable.
Ronald
--=20
Ronald Fischer <[email protected]>
Phone: +49-89-452133-162
LD_LIBRARY_PATH and so on, and is intended to run under Windows, Cygwin,
and Linux/Unix type of systems. Example:
On Windows:
set MY_SEARCH_PATH=3DC:\LIB1;D:\LIB2
On Linux:
export MY_SEARCH_PATH=3D/usr/lib/LIB1:$HOME/LIB2
Of course this means that if in order to decompose a pathlist, I need to
know whether to split on ';' (for Windows) or on ':' (for the rest of
the=20
world). How can I most easily decide at runtime, what "style" of system=20
I am running?
I found the constant RUBY_PLATFORM, but it is a bit too specific,
returning
things like "i386-mswin32" for my Windows.
How do other people deal with this problem? Do you consider it safe to
assume
- "Cygwin" when RUBY_PLATFORM=3D=3D'cygwin', else
- "Windows" style path when RUBY_PLATFORM =3D~ /win/i
- "Unix" style path otherwise?
I am aware that there is likely no solution which is 100% waterproof,
but
I am happy when I find one which is reasonably stable.
Ronald
--=20
Ronald Fischer <[email protected]>
Phone: +49-89-452133-162