Changeset 365 in tmcsimulator for trunk/src/tmcsim/common/RevisionNumber.java
- Timestamp:
- 04/11/2019 07:01:03 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/tmcsim/common/RevisionNumber.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/common/RevisionNumber.java
r6 r365 2 2 3 3 import java.io.File; 4 import java.io.IOException; 5 import java.util.Properties; 4 6 import java.util.Scanner; 5 7 import java.util.logging.Level; … … 15 17 * @author jdalbey 16 18 */ 17 public class RevisionNumber19 public final class RevisionNumber 18 20 { 19 21 20 22 private static Logger logger = Logger.getLogger("tmcsim.common"); 21 23 // Read the subversion revision info and return it 22 24 /** 25 * Read the version number from the application properties. The file 26 * 'application.properties' is generated by build.xml. 27 * 28 * @return a version string obtained from application.properties file, or 29 * "Version: unknown" if an IOerror prevents us from reading the file. 30 */ 31 public static String getAppVersion() 32 { 33 String propfilename = "/tmcsim/application.properties"; 34 String propKey = "Application.revision"; 35 String version = "unknown"; 36 try 37 { 38 Properties props = new Properties(); 39 props.load(RevisionNumber.class.getResourceAsStream(propfilename)); 40 version = (String) props.get(propKey); 41 } catch (IOException ex) 42 { 43 Logger.getLogger("tmcsim/common").log(Level.SEVERE, 44 "getAppVersion(): IOError reading " + propfilename); 45 } catch (NullPointerException npe) 46 { 47 Logger.getLogger("tmcsim/common").log(Level.SEVERE, 48 "getAppVersion().load: Missing file: " + propfilename); 49 } 50 return "revision: " + version; 51 } 52 23 53 /** 24 54 * Return the version number as a string. The revision number is generated
Note: See TracChangeset
for help on using the changeset viewer.
