commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berin Loritsch" <blorit...@apache.org>
Subject RE: [lang] OS family
Date Thu, 22 Aug 2002 19:53:17 GMT
It would be useful in my SystemUtils class that I have in
Excalibur Utils.

I offered to move it to commons, but I'm not sure where the
best place should be.

> -----Original Message-----
> From: Stephen Colebourne [mailto:scolebourne@btopenworld.com] 
> Sent: Thursday, August 22, 2002 3:56 PM
> To: Jakarta Commons Developers List
> Subject: [lang] OS family
> 
> 
> Another utility I have allows the OS family name to be 
> determined. Currently it is very hard to determine if the 
> system is Mac, Windows or Unix. This is because the string 
> names used are not controlled by Sun. (Unix is the worst). 
> This code evaluates the os.name system property and extracts 
> one of four operating systems:
> 
>     static {
>         // from http://www.geocities.com/vamp201/os.html
>         if (OS_NAME.startsWith("Windows")) {
>             OS_FAMILY = UOSFamily.WINDOWS;
>         } else if (OS_NAME.startsWith("SunOS")) {
>             OS_FAMILY = UOSFamily.UNIX;
>         } else if (OS_NAME.startsWith("Solaris")) {
>             OS_FAMILY = UOSFamily.UNIX;
>         } else if (OS_NAME.startsWith("Linux")) {
>             OS_FAMILY = UOSFamily.UNIX;
>         } else if (OS_NAME.startsWith("HP-UX")) {
>             OS_FAMILY = UOSFamily.UNIX;
>         } else if (OS_NAME.startsWith("AIX")) {
>             OS_FAMILY = UOSFamily.UNIX;
>         } else if (OS_NAME.startsWith("Irix")) {
>             OS_FAMILY = UOSFamily.UNIX;
>         } else if (OS_NAME.startsWith("Digital Unix")) {
>             OS_FAMILY = UOSFamily.UNIX;
>         } else if (OS_NAME.startsWith("OS/2")) {
>             OS_FAMILY = UOSFamily.OS_2;
>         } else if (OS_NAME.startsWith("Mac")) {
>             OS_FAMILY = UOSFamily.MAC;
>         } else {
>             OS_FAMILY = null;
>         }
>     }
> 
> Any use to lang?
> 
> Stephen
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:commons-dev-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <mailto:commons-dev-help@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message