Ronald Fischer
7/17/2007 2:03:00 PM
My application deals with pathlists similar to what we know from PATH,
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=C:\LIB1;D:\LIB2
On Linux:
export MY_SEARCH_PATH=/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
world). How can I most easily decide at runtime, what "style" of system
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=='cygwin', else
- "Windows" style path when RUBY_PLATFORM =~ /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
--
Ronald Fischer <ronald.fischer@venyon.com>
Phone: +49-89-452133-162