Skip to content

Mat.getOS will never return OS_ANDROID #51

@phlip9

Description

@phlip9

Noticed this issue while browsing through Mat.scala, notably, on in the getOS function:

  final val OS_WINDOWS = 0;
  final val OS_LINUX = 1;
  final val OS_OSX = 2;
  final val OS_ANDROID = 3;

  def getOS:Int = {
    val osname = System.getProperty("os.name");
    if (osname.startsWith("Windows")) OS_WINDOWS
    else if (osname.startsWith("Linux")) OS_LINUX
    else if (osname.startsWith("Mac")) OS_OSX
    else OS_ANDROID    
  }

  val ostype = getOS  

According to http://developer.android.com/reference/java/lang/System.html#getProperty(java.lang.String), System.getProperty("os.name") always returns "Linux" on Android.

Seems like another way might be to check System.getProperty("java.vendor") for "The Android Project", then System.getProperty("os.name") for the remaining platforms?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions