clarified signature;
authorwenzelm
Wed, 23 Jan 2019 20:45:03 +0100
changeset 69726 461f0615faa3
parent 69725 88b8bc6a6e5f
child 69727 55dc07077c6b
clarified signature;
src/Pure/Admin/build_polyml.scala
src/Pure/System/platform.scala
--- a/src/Pure/Admin/build_polyml.scala	Wed Jan 23 20:27:00 2019 +0100
+++ b/src/Pure/Admin/build_polyml.scala	Wed Jan 23 20:45:03 2019 +0100
@@ -57,8 +57,7 @@
       error("Bad Poly/ML root directory: " + root)
 
     val platform_arch = if (arch_64) "x86_64" else "x86_64_32"
-    val platform_os =
-      if (Platform.is_windows) "windows" else if (Platform.is_macos) "darwin" else "linux"
+    val platform_os = Platform.os_name
 
     val platform = platform_arch + "-" + platform_os
     val platform_64 = "x86_64-" + platform_os
--- a/src/Pure/System/platform.scala	Wed Jan 23 20:27:00 2019 +0100
+++ b/src/Pure/System/platform.scala	Wed Jan 23 20:45:03 2019 +0100
@@ -36,30 +36,23 @@
 
   /* platform identifiers */
 
-  private val Linux = """Linux""".r
-  private val Darwin = """Mac OS X""".r
-  private val Windows = """Windows.*""".r
-
   private val X86 = """i.86|x86""".r
   private val X86_64 = """amd64|x86_64""".r
 
-  lazy val jvm_platform: String =
-  {
-    val arch =
-      System.getProperty("os.arch", "") match {
-        case X86() => "x86"
-        case X86_64() => "x86_64"
-        case _ => error("Failed to determine CPU architecture")
-      }
-    val os =
-      System.getProperty("os.name", "") match {
-        case Linux() => "linux"
-        case Darwin() => "darwin"
-        case Windows() => "windows"
-        case _ => error("Failed to determine operating system platform")
-      }
-    arch + "-" + os
-  }
+  def cpu_arch: String =
+    System.getProperty("os.arch", "") match {
+      case X86() => "x86"
+      case X86_64() => "x86_64"
+      case _ => error("Failed to determine CPU architecture")
+    }
+
+  def os_name: String =
+    family match {
+      case Family.macos => "darwin"
+      case _ => family.toString
+    }
+
+  lazy val jvm_platform: String = cpu_arch + "-" + os_name
 
 
   /* JVM version */