Hi, Is there any reason we can''t use this to detect Windows? File::PATH_SEPARATOR == '';'' Is there any other platform that uses '';'' as a path separator? Regards, Dan
On Tue, Jan 18, 2011 at 1:01 AM, Daniel Berger <djberg96 at gmail.com> wrote:> Hi, > > Is there any reason we can''t use this to detect Windows? > > File::PATH_SEPARATOR == '';'' > > Is there any other platform that uses '';'' as a path separator? >If you''re doing cross-compilation, that can''t be used as is not been set. mkmf extensions that contain code that depends on the platform will not be able to be cross compiled if you use that. RUBY_PLATFORM and File::ALT_SEPARATOR are the only ones been set. Normally ALT_SEPARATOR is nil on every platform except Windows. -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup?ry
On 1/18/11 4:44 AM, Luis Lavena wrote:> On Tue, Jan 18, 2011 at 1:01 AM, Daniel Berger<djberg96 at gmail.com> wrote: >> Hi, >> >> Is there any reason we can''t use this to detect Windows? >> >> File::PATH_SEPARATOR == '';'' >> >> Is there any other platform that uses '';'' as a path separator? >> > > If you''re doing cross-compilation, that can''t be used as is not been set. > > mkmf extensions that contain code that depends on the platform will > not be able to be cross compiled if you use that. > > RUBY_PLATFORM and File::ALT_SEPARATOR are the only ones been set. > Normally ALT_SEPARATOR is nil on every platform except Windows. >Based on this: http://en.wikipedia.org/wiki/Path_(computing) I''m guessing that File::ALT_SEPARATOR could be non-nil on some of those platforms. OpenVMS, for instance. I''ve never built Ruby on OpenVMS, so I can''t say for sure. Besides cross-compiling is THE DEVIL. Dan
On Tue, Jan 18, 2011 at 10:01 AM, Daniel Berger <djberg96 at gmail.com> wrote:> > Besides cross-compiling is THE DEVIL. >But sometimes you need to deal with the devil. In my experience cross-compilation options had helped me increase gem authors to care about providing binaries for Windows, even complex ones like nokogiri that depends on libxml2 Without making deals with the devil, lot of gems will be lacking proper support or binaries for Windows. As for the ALT_SEPARATOR, From the link you provide cannot see how that will be non-nil. You can ask Ruby-Core. -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup?ry
On 1/18/11 4:44 AM, Luis Lavena wrote:> On Tue, Jan 18, 2011 at 1:01 AM, Daniel Berger<djberg96 at gmail.com> wrote:<snip>> RUBY_PLATFORM and File::ALT_SEPARATOR are the only ones been set. > Normally ALT_SEPARATOR is nil on every platform except Windows. >Looking at defines.h I see this: #if defined(MSDOS) || defined(_WIN32) || defined(__human68k__) || defined(__EMX__) #define DOSISH 1 #ifndef _WIN32_WCE # define DOSISH_DRIVE_LETTER #endif #endif Wikipedia tells me that human68k is an OS for a Sharp workstation. EMX is a programming environment for DOS and OS/2. Ruby''s file.c simply makes this check: #ifdef DOSISH rb_define_const(rb_cFile, "ALT_SEPARATOR", rb_obj_freeze(rb_str_new2("\\"))); #else rb_define_const(rb_cFile, "ALT_SEPARATOR", Qnil); #endif Hm, maybe I have nothing to worry about after all. I *thought* the configure script would be a little more robust than that, but I guess not. Anyway, I guess I''ll go back to using File::ALT_SEPARATOR after all since I don''t care about Sharp''s OS, and the rest are one DOS environment or another. Regards, Dan