Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mat.getOS will never return OS_ANDROID #51

Open
phlip9 opened this issue Dec 7, 2015 · 0 comments
Open

Mat.getOS will never return OS_ANDROID #51

phlip9 opened this issue Dec 7, 2015 · 0 comments

Comments

@phlip9
Copy link
Contributor

phlip9 commented Dec 7, 2015

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant