[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSProcessInfo incompleteness
From: |
Gregory Casamento |
Subject: |
Re: NSProcessInfo incompleteness |
Date: |
Sun, 7 Apr 2002 23:10:12 -0700 (PDT) |
See below...
--- Marcus_Müller <address@hidden> wrote:
> And once again ...
>
> Just found out that
>
> - (unsigned int)operatingSystem;
> - (NSString *)operatingSystemName;
>
> are missing from NSProcessInfo. I'm not sure if they're part of the
> OPENSTEP spec, but they are part of OS X Server 1.x and OS X 10.0.x.
> While I never found the first method usable at all, the second is usable
> by socket servers that like to give away some info of the host system.
> IMO the latter could be implemented as easy as this:
>
> - (NSString *)operatingSystemName;
> {
> NSString *env = [[NSProcessInfo processInfo] environment];
> NSString *str = [env objectForKey: @"GNUSTEP_HOST_CPU"];
> return str;
> }
>
> Probably with better error checking, although it'd be interesting what
> should be assumed as default if this info can't be found during
> runtime ... hm.
>
> Cheers,
>
> Marcus
Marcus,
These two methods are not part of the OpenStep spec. Since we are, however,
going for compatibility w/ MOSX I would recommend that they be implemented.
GNUSTEP_HOST_CPU returns the architechture, not the OS. I believe you meant
GNUSTEP_HOST_OS. Even that, however, may not be sufficient...
If you look at:
http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSProcessInfo.html
You'll see that the operatingSystem method you mention returns one of the
following constants:
NSHPUXOperatingSystem
NSMACHOperatingSystem
NSOSF1OperatingSystem
NSSolarisOperatingSystem
NSSunOSOperatingSystem
NSWindows95OperatingSystem
NSWindowsNTOperatingSystem
The operatingSystemName method returns a string corresponding to one of the
above. For Linux we will likely need to add a GNUstep specific constant.
Probably something like "GSLinuxOperatingSystem". We can, of course, use the
value returned by GNUSTEP_HOST_OS to determine which of these constants to
select.
GJC
=====
Gregory John Casamento
------------------------------------------------------
Please sign the petition against software patents at:
http://www.petitiononline.com/pasp01/petition.html
------------------------------------------------------
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/