blob: 6100d3bac9999de398f0ffb2ee6f6544669c17bb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2006-2008, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala.util
/** 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-2008 LAMP/EPFL"
props.getProperty("copyright.string", defaultString)
}
val encodingString: String = {
val defaultString = "UTF8" //"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)
}
}
|