summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-05-11 13:16:31 +0000
committermichelou <michelou@epfl.ch>2007-05-11 13:16:31 +0000
commit95d627ef594d44c18fddc6556916720c5578bac2 (patch)
tree1af3f0a59d64c1ea437ea9701f4ce53f96544b83 /src
parent59ab197fef66d0b640fca11bd8fa005400bc6429 (diff)
downloadscala-95d627ef594d44c18fddc6556916720c5578bac2.tar.gz
scala-95d627ef594d44c18fddc6556916720c5578bac2.tar.bz2
scala-95d627ef594d44c18fddc6556916720c5578bac2.zip
added property file to scala-library.jar
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/runtime/Properties.scala57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/library/scala/runtime/Properties.scala b/src/library/scala/runtime/Properties.scala
new file mode 100644
index 0000000000..3e46646f2b
--- /dev/null
+++ b/src/library/scala/runtime/Properties.scala
@@ -0,0 +1,57 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2006-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id$
+
+package scala.runtime
+
+/** A utility to load the library properties from a Java properties file
+ * included in the jar.
+ *
+ * @author Stephane Micheloud
+ */
+object Properties {
+
+ /** The name of the properties file */
+ private val propFilename = "/library.properties"
+
+ /** The loaded properties */
+ private val props = {
+ val props = new java.util.Properties
+ val stream = classOf[Application].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-2007 LAMP/EPFL"
+ props.getProperty("copyright.string", defaultString)
+ }
+
+ val encodingString: String = {
+ val defaultString = "ISO-8859-1"
+ props.getProperty("file.encoding", defaultString)
+ }
+
+ private val writer = new java.io.PrintWriter(Console.err, true)
+
+ val versionMsg = "Scala library " + versionString + " -- " + copyrightString
+
+ def main(args: Array[String]) {
+ writer.println(versionMsg)
+ }
+}