summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/Properties.scala
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-01-29 16:53:19 +0000
committermichelou <michelou@epfl.ch>2007-01-29 16:53:19 +0000
commitfba3480e739e2fe318fa9dcb71da424fb90d06fd (patch)
treee5639c31570122ab0e708be84c701306f795c31b /src/compiler/scala/tools/nsc/Properties.scala
parent0e147167565d625c7713a6e74c3d58d0ace24439 (diff)
downloadscala-fba3480e739e2fe318fa9dcb71da424fb90d06fd.tar.gz
scala-fba3480e739e2fe318fa9dcb71da424fb90d06fd.tar.bz2
scala-fba3480e739e2fe318fa9dcb71da424fb90d06fd.zip
moved version/copyright properties from source ...
moved version/copyright properties from source code to property file
Diffstat (limited to 'src/compiler/scala/tools/nsc/Properties.scala')
-rw-r--r--src/compiler/scala/tools/nsc/Properties.scala48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/Properties.scala b/src/compiler/scala/tools/nsc/Properties.scala
new file mode 100644
index 0000000000..ea13f14a81
--- /dev/null
+++ b/src/compiler/scala/tools/nsc/Properties.scala
@@ -0,0 +1,48 @@
+/* NSC -- new Scala compiler
+ * Copyright 2006-2007 LAMP/EPFL
+ * @author Stephane Micheloud
+ */
+
+// $Id: $
+
+package scala.tools.nsc
+
+/** 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 = "/compiler.properties"
+
+ /** The loaded properties */
+ private val props = {
+ val props = new java.util.Properties
+ val stream = classOf[Global].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-2006 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"
+ }
+
+}