Skip to content

Commit a3107f0

Browse files
committed
[backport] SI-7497 Fix scala.util.Properties.isMac
It returned wrong values because it used the java.vendor property instead of os.name, as specified in developer.apple.com/library/mac/#technotes/tn2002/tn2110.
1 parent 0f5b1e8 commit a3107f0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/library/scala/util/Properties.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private[scala] trait PropertiesTrait {
6767
* it is an RC, Beta, etc. or was built from source, or if the version
6868
* cannot be read.
6969
*/
70-
val releaseVersion =
70+
val releaseVersion =
7171
for {
7272
v <- scalaPropOrNone("maven.version.number")
7373
if !(v endsWith "-SNAPSHOT")
@@ -81,7 +81,7 @@ private[scala] trait PropertiesTrait {
8181
* @return Some(version) if this is a non-final version, None if this
8282
* is a final release or the version cannot be read.
8383
*/
84-
val developmentVersion =
84+
val developmentVersion =
8585
for {
8686
v <- scalaPropOrNone("maven.version.number")
8787
if v endsWith "-SNAPSHOT"
@@ -109,8 +109,7 @@ private[scala] trait PropertiesTrait {
109109
*/
110110
def lineSeparator = propOrElse("line.separator", "\n")
111111

112-
/** Various well-known properties.
113-
*/
112+
/* Various well-known properties. */
114113
def javaClassPath = propOrEmpty("java.class.path")
115114
def javaHome = propOrEmpty("java.home")
116115
def javaVendor = propOrEmpty("java.vendor")
@@ -126,10 +125,11 @@ private[scala] trait PropertiesTrait {
126125
def userHome = propOrEmpty("user.home")
127126
def userName = propOrEmpty("user.name")
128127

129-
/** Some derived values.
130-
*/
128+
/* Some derived values. */
129+
/** Returns `true` iff the underlying operating system is a version of Microsoft Windows. */
131130
def isWin = osName startsWith "Windows"
132-
def isMac = javaVendor startsWith "Apple"
131+
/** Returns `true` iff the underlying operating system is a version of Apple Mac OSX. */
132+
def isMac = osName contains "OS X" // See developer.apple.com/library/mac/#technotes/tn2002/tn2110
133133

134134
def versionMsg = "Scala %s %s -- %s".format(propCategory, versionString, copyrightString)
135135
def scalaCmd = if (isWin) "scala.bat" else "scala"

0 commit comments

Comments
 (0)