more detailed platform identification;
authorwenzelm
Sat, 27 Jun 2009 22:14:13 +0200
changeset 3182280fd718796ce
parent 31821 ce6be870a5d3
child 31823 42f897a7017f
more detailed platform identification;
src/Pure/System/isabelle_system.scala
     1.1 --- a/src/Pure/System/isabelle_system.scala	Sat Jun 27 19:24:34 2009 +0200
     1.2 +++ b/src/Pure/System/isabelle_system.scala	Sat Jun 27 22:14:13 2009 +0200
     1.3 @@ -16,11 +16,44 @@
     1.4  
     1.5  object Isabelle_System
     1.6  {
     1.7 -
     1.8    val charset = "UTF-8"
     1.9  
    1.10 +
    1.11 +  /* platform identification */
    1.12 +
    1.13    val is_cygwin = System.getProperty("os.name").startsWith("Windows")
    1.14  
    1.15 +  private val X86 = new Regex("i.86|x86")
    1.16 +  private val X86_64 = new Regex("amd64|x86_64")
    1.17 +  private val Sparc = new Regex("sparc")
    1.18 +  private val PPC = new Regex("PowerPC|ppc")
    1.19 +
    1.20 +  private val Solaris = new Regex("SunOS|Solaris")
    1.21 +  private val Linux = new Regex("Linux")
    1.22 +  private val Darwin = new Regex("Mac OS X")
    1.23 +  private val Cygwin = new Regex("Windows.*")
    1.24 +
    1.25 +  val platform: Option[String] =
    1.26 +  {
    1.27 +    val name =
    1.28 +      java.lang.System.getProperty("os.name") match {
    1.29 +        case Solaris() => "solaris"
    1.30 +        case Linux() => "linux"
    1.31 +        case Darwin() => "darwin"
    1.32 +        case Cygwin() => "cygwin"
    1.33 +        case _ => ""
    1.34 +      }
    1.35 +    val arch =
    1.36 +      java.lang.System.getProperty("os.arch") match {
    1.37 +        case X86() | X86_64() => "x86"
    1.38 +        case Sparc() => "sparc"
    1.39 +        case PPC() => "ppc"
    1.40 +        case _ => ""
    1.41 +      }
    1.42 +    if (arch == "" || name == "") None
    1.43 +    else Some(arch + "-" + name)
    1.44 +  }
    1.45 +
    1.46  
    1.47    /* shell processes */
    1.48