Skip to content

Commit

Permalink
SI-7497 Fix scala.util.Properties.isMac
Browse files Browse the repository at this point in the history
It returned wrong values because it used the java.vendor
property instead of os.name.

See http://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-November/005148.html
for the reason why we don't follow developer.apple.com/library/mac/#technotes/tn2002/tn2110.
  • Loading branch information
soc committed May 23, 2013
1 parent b45e2b7 commit d38e8ae
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/library/scala/util/Properties.scala
Expand Up @@ -72,7 +72,7 @@ private[scala] trait PropertiesTrait {
* it is an RC, Beta, etc. or was built from source, or if the version
* cannot be read.
*/
val releaseVersion =
val releaseVersion =
for {
v <- scalaPropOrNone("maven.version.number")
if !(v endsWith "-SNAPSHOT")
Expand All @@ -86,7 +86,7 @@ private[scala] trait PropertiesTrait {
* @return Some(version) if this is a non-final version, None if this
* is a final release or the version cannot be read.
*/
val developmentVersion =
val developmentVersion =
for {
v <- scalaPropOrNone("maven.version.number")
if v endsWith "-SNAPSHOT"
Expand Down Expand Up @@ -119,8 +119,7 @@ private[scala] trait PropertiesTrait {
*/
def lineSeparator = propOrElse("line.separator", "\n")

/** Various well-known properties.
*/
/* Various well-known properties. */
def javaClassPath = propOrEmpty("java.class.path")
def javaHome = propOrEmpty("java.home")
def javaVendor = propOrEmpty("java.vendor")
Expand All @@ -136,10 +135,13 @@ private[scala] trait PropertiesTrait {
def userHome = propOrEmpty("user.home")
def userName = propOrEmpty("user.name")

/** Some derived values.
*/
/* Some derived values. */
/** Returns `true` iff the underlying operating system is a version of Microsoft Windows. */
def isWin = osName startsWith "Windows"
def isMac = javaVendor startsWith "Apple"
// See http://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-November/005148.html for
// the reason why we don't follow developer.apple.com/library/mac/#technotes/tn2002/tn2110.
/** Returns `true` iff the underlying operating system is a version of Apple Mac OSX. */
def isMac = osName startsWith "Mac OS X"

// This is looking for javac, tools.jar, etc.
// Tries JDK_HOME first, then the more common but likely jre JAVA_HOME,
Expand Down

0 comments on commit d38e8ae

Please sign in to comment.