From: amwaterhouse Date: Thu, 17 Mar 2005 15:08:07 +0000 (+0000) Subject: checks for last update X-Git-Tag: Release_2_0~576 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=39999407e5700d94a4cdf792115ce9b85a1cdf87;p=jalview.git checks for last update --- diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index e0edae8..5990616 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -11,8 +11,12 @@ package jalview.bin; import java.util.*; import java.io.*; +import java.util.jar.*; public class Cache { + public static String VERSION = "ß test"; + public static String BUILD_DATE = "1-1-2005"; + public static Properties applicationProperties; // Current properties include: // @@ -26,6 +30,34 @@ public class Cache public static void loadProperties() { + // get last build time. + try{ + long date = 0; + + String localFile = Cache.class.getProtectionDomain().getCodeSource().getLocation().toString(); + localFile = localFile.concat("!/"); + String tmpString = "jar:"; + String localJarFileString = tmpString.concat(localFile); + java.net.URL localJarFileURL = new java.net.URL(localJarFileString); + java.net.JarURLConnection localJarFile = (java.net.JarURLConnection)localJarFileURL.openConnection(); + + date = localJarFile.getLastModified(); + + if(date==0) + { + // this is called for unpackaged class files. + // not entirely accurate as it only tells you when Cache.class was last compiled + java.net.URL url = Cache.class.getResource("/jalview/bin/Cache.class"); + java.io.File f = new java.io.File(url.getFile()); + date = f.lastModified(); + } + + BUILD_DATE = new Date( date ).toString(); + + + }catch(Exception ex){ex.printStackTrace();} + + applicationProperties = new Properties(); try