From d7bd4e2d8ee8384c06b33642da22f026864ce1f2 Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 3 May 2003 00:12:42 +0000 Subject: [PATCH] Linux isn't excepted from wacky issues. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1112 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../java/com/samskivert/util/RunAnywhere.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java b/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java index 5423d6d1..f30d3dd1 100644 --- a/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java +++ b/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java @@ -1,5 +1,5 @@ // -// $Id: RunAnywhere.java,v 1.2 2003/05/03 00:06:23 mdb Exp $ +// $Id: RunAnywhere.java,v 1.3 2003/05/03 00:12:42 ray Exp $ package com.samskivert.util; @@ -30,6 +30,15 @@ public class RunAnywhere return _isMacOS; } + /** + * Returns true if we're running in a JVM that identifies its + * operating system as Linux. + */ + public static final boolean isLinux () + { + return _isLinux; + } + /** * Returns the timestamp associated with the supplied event except on * the Macintosh where it returns {@link System#currentTimeMillis} @@ -49,6 +58,10 @@ public class RunAnywhere * is first loaded. */ protected static boolean _isMacOS; + /** Flag indicating that we're on Linux; initialized when this class + * is first loaded. */ + protected static boolean _isLinux; + static { try { String osname = System.getProperty("os.name"); @@ -56,6 +69,7 @@ public class RunAnywhere _isWindows = (osname.indexOf("Windows") != -1); _isMacOS = (osname.indexOf("Mac OS") != -1 || osname.indexOf("MacOS") != -1); + _isLinux = (osname.indexOf("Linux") != -1); } catch (Exception e) { // dang, can't grab system properties; we'll just pretend // we're not on any of these OSes