[Win32utils-devel] Windows platform detection

Daniel Berger djberg96 at gmail.com
Tue Jan 18 20:42:14 EST 2011


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


More information about the win32utils-devel mailing list