diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/Properties.scala | 11 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala | 2 | ||||
-rw-r--r-- | src/library/scala/util/Properties.scala | 9 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/utils/Properties.scala | 10 | ||||
-rw-r--r-- | src/scalap/scala/tools/scalap/Properties.scala | 46 |
5 files changed, 17 insertions, 61 deletions
diff --git a/src/compiler/scala/tools/nsc/Properties.scala b/src/compiler/scala/tools/nsc/Properties.scala index 4ec98a1d0c..e85284dbe2 100644 --- a/src/compiler/scala/tools/nsc/Properties.scala +++ b/src/compiler/scala/tools/nsc/Properties.scala @@ -6,12 +6,9 @@ // $Id$ package scala.tools.nsc -import scala.util.PropertiesTrait -/** A utility to load the compiler properties from a Java properties file - * included in the jar. - */ -object Properties extends PropertiesTrait { +/** Loads compiler.properties from the jar. */ +object Properties extends scala.util.PropertiesTrait { protected def propCategory = "compiler" protected def pickJarBasedOn = classOf[Global] @@ -19,11 +16,9 @@ object Properties extends PropertiesTrait { val fileEndingString = prop("file.ending", ".scala|.java") val residentPromptString = prop("resident.prompt", "\nnsc> ") val shellPromptString = prop("shell.prompt", "\nscala> ") + val cmdName = if (isWin) "scala.bat" else "scala" // settings based on System properties - val isWin = sysprop("os.name", "") startsWith "Windows" - val scalaHome = sysprop("scala.home", null) val envClasspath = sysprop("env.classpath", null) val msilILasm = sysprop("msil.ilasm", "") - val cmdName = if (isWin) "scala.bat" else "scala" } diff --git a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala index 9cc23381f0..5b50164b26 100644 --- a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala +++ b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala @@ -24,7 +24,7 @@ trait InteractiveReader { } private def restartSystemCall(e: Exception): Boolean = - (vendor startsWith "Apple") && (e.getMessage == msgEINTR) + Properties.isMac && (e.getMessage == msgEINTR) } diff --git a/src/library/scala/util/Properties.scala b/src/library/scala/util/Properties.scala index 77a2a10c4c..45ccb15985 100644 --- a/src/library/scala/util/Properties.scala +++ b/src/library/scala/util/Properties.scala @@ -54,6 +54,9 @@ private[scala] trait PropertiesTrait val versionString = "version " + prop("version.number", "(unknown)") val copyrightString = prop("copyright.string", "(c) 2002-2009 LAMP/EPFL") val encodingString = prop("file.encoding", "UTF8") + val isWin = sysprop("os.name", "") startsWith "Windows" + val isMac = sysprop("java.vendor", "") startsWith "Apple" + val scalaHome = sysprop("scala.home", null) // provide a main method so version info can be obtained by running this private val writer = new java.io.PrintWriter(Console.err, true) @@ -61,11 +64,7 @@ private[scala] trait PropertiesTrait def main(args: Array[String]) { writer println versionMsg } } -/** A utility to load the library properties from a Java properties file - * included in the jar. - * - * @author Stephane Micheloud - */ +/** Loads library.properties from the jar. */ object Properties extends PropertiesTrait { protected def propCategory = "library" protected def pickJarBasedOn = classOf[Application] diff --git a/src/partest/scala/tools/partest/utils/Properties.scala b/src/partest/scala/tools/partest/utils/Properties.scala index d75791c0e7..8c96083306 100644 --- a/src/partest/scala/tools/partest/utils/Properties.scala +++ b/src/partest/scala/tools/partest/utils/Properties.scala @@ -10,14 +10,8 @@ package scala.tools.partest.utils -import scala.util.PropertiesTrait - -/** A utility to load the library properties from a Java properties file - * included in the jar. - * - * @author Stephane Micheloud - */ -object Properties extends PropertiesTrait { +/** Loads partest.properties from the jar. */ +object Properties extends scala.util.PropertiesTrait { protected def propCategory = "partest" protected def pickJarBasedOn = classOf[Application] diff --git a/src/scalap/scala/tools/scalap/Properties.scala b/src/scalap/scala/tools/scalap/Properties.scala index 302b0ec463..05452c448e 100644 --- a/src/scalap/scala/tools/scalap/Properties.scala +++ b/src/scalap/scala/tools/scalap/Properties.scala @@ -9,42 +9,10 @@ package scala.tools.scalap -/** A utility to load the compiler properties from a Java properties file - * included in the jar. - */ -object Properties { - - /** The name of the properties file */ - private val propFilename = "/decoder.properties" - - /** The loaded properties */ - private val props = { - val props = new java.util.Properties - val stream = classOf[Classfile].getResourceAsStream(propFilename) - if (stream != null) - props.load(stream) - props - } - - /** The version number of the jar this was loaded from, or - * "(unknown)" if it cannot be determined. - */ - val versionString: String = { - val defaultString = "(unknown)" - "version " + props.getProperty("version.number") - } - - val copyrightString: String = { - val defaultString = "(c) 2002-2009 LAMP/EPFL" - props.getProperty("copyright.string", defaultString) - } - - val scalaHome: String = - System.getProperty("scala.home") - - val cmdName: String = { - val isWin = System.getProperty("os.name") startsWith "Windows" - if (isWin) "scala.bat" else "scala" - } - -} +/** Loads decoder.properties from the jar. */ +object Properties extends scala.util.PropertiesTrait +{ + protected def propCategory = "decoder" + protected def pickJarBasedOn = classOf[Classfile] + val cmdName = nsc.Properties.cmdName +}
\ No newline at end of file |