src/Pure/System/platform.scala
changeset 69726 461f0615faa3
parent 69410 c071fcec4323
child 71383 8313dca6dee9
equal deleted inserted replaced
69725:88b8bc6a6e5f 69726:461f0615faa3
    34   }
    34   }
    35 
    35 
    36 
    36 
    37   /* platform identifiers */
    37   /* platform identifiers */
    38 
    38 
    39   private val Linux = """Linux""".r
       
    40   private val Darwin = """Mac OS X""".r
       
    41   private val Windows = """Windows.*""".r
       
    42 
       
    43   private val X86 = """i.86|x86""".r
    39   private val X86 = """i.86|x86""".r
    44   private val X86_64 = """amd64|x86_64""".r
    40   private val X86_64 = """amd64|x86_64""".r
    45 
    41 
    46   lazy val jvm_platform: String =
    42   def cpu_arch: String =
    47   {
    43     System.getProperty("os.arch", "") match {
    48     val arch =
    44       case X86() => "x86"
    49       System.getProperty("os.arch", "") match {
    45       case X86_64() => "x86_64"
    50         case X86() => "x86"
    46       case _ => error("Failed to determine CPU architecture")
    51         case X86_64() => "x86_64"
    47     }
    52         case _ => error("Failed to determine CPU architecture")
    48 
    53       }
    49   def os_name: String =
    54     val os =
    50     family match {
    55       System.getProperty("os.name", "") match {
    51       case Family.macos => "darwin"
    56         case Linux() => "linux"
    52       case _ => family.toString
    57         case Darwin() => "darwin"
    53     }
    58         case Windows() => "windows"
    54 
    59         case _ => error("Failed to determine operating system platform")
    55   lazy val jvm_platform: String = cpu_arch + "-" + os_name
    60       }
       
    61     arch + "-" + os
       
    62   }
       
    63 
    56 
    64 
    57 
    65   /* JVM version */
    58   /* JVM version */
    66 
    59 
    67   private val Version = """1\.(\d+)\.0_(\d+)""".r
    60   private val Version = """1\.(\d+)\.0_(\d+)""".r