From 39999407e5700d94a4cdf792115ce9b85a1cdf87 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 17 Mar 2005 15:08:07 +0000 Subject: [PATCH] checks for last update --- src/jalview/bin/Cache.java | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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 -- 1.7.10.2