You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2022/03/15 17:19:03 UTC

[isis] 01/02: ISIS-2877: more polishing

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 31ff6fd7c338c4442ede0ee44329bb554f9d785d
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Mar 15 10:05:23 2022 +0100

    ISIS-2877: more polishing
---
 .../apache/isis/commons/internal/os/_OsUtil.java   | 27 +++++++++++-----------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/commons/src/main/java/org/apache/isis/commons/internal/os/_OsUtil.java b/commons/src/main/java/org/apache/isis/commons/internal/os/_OsUtil.java
index 02b7637..330f977 100644
--- a/commons/src/main/java/org/apache/isis/commons/internal/os/_OsUtil.java
+++ b/commons/src/main/java/org/apache/isis/commons/internal/os/_OsUtil.java
@@ -55,22 +55,21 @@ public class _OsUtil {
         public boolean isWindows() { return this==WINDOWS; }
         public boolean isLinux() { return this==LINUX; }
         public boolean isMacOs() { return this==MAC_OS; }
-    }
-
-    public OS currentOs() {
-        if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
-            return OS.WINDOWS;
-        }
-        if (System.getProperty("os.name").toLowerCase().contains("linux")) {
-            return OS.LINUX;
+        public static OS current() {
+            val osName = System.getProperty("os.name").toLowerCase();
+            if (osName.startsWith("windows")) {
+                return OS.WINDOWS;
+            }
+            if (osName.contains("linux")) {
+                return OS.LINUX;
+            }
+            if (osName.contains("mac")) {
+                return OS.MAC_OS;
+            }
+            return OS.OTHER;
         }
-        if (System.getProperty("os.name").toLowerCase().contains("mac")) {
-            return OS.MAC_OS;
-        }
-        return OS.OTHER;
     }
 
-
     /**
      * Uses given {@code pidFile} as a way to communicate between processes,
      * whether there is already a running one.
@@ -109,7 +108,7 @@ public class _OsUtil {
             return; // do nothing
         }
         val rt = Runtime.getRuntime();
-        val os = currentOs();
+        val os = OS.current();
         final String cmd;
         switch(os) {
         case WINDOWS: