URL getresource adds %20 for spaces. Use user.dir instead
authoramwaterhouse <Andrew Waterhouse>
Tue, 24 May 2005 11:23:15 +0000 (11:23 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 24 May 2005 11:23:15 +0000 (11:23 +0000)
src/jalview/bin/Cache.java

index ed1a93f..66518fa 100755 (executable)
@@ -15,7 +15,7 @@ import java.util.jar.*;
 public class Cache\r
 {\r
   public static String  VERSION = "Release 2.0";\r
-  public static String  BUILD_DATE = "01-05-2005";\r
+  public static String  BUILD_DATE = "";\r
 \r
   public static Properties applicationProperties;\r
   // Current properties include:\r
@@ -43,14 +43,17 @@ public class Cache
     }catch(Exception ex){ex.printStackTrace();}\r
     if(date==0)\r
     {\r
-      // this is called for unpackaged class files.\r
+      // this is called for unpackaged class files, ie not in a Jar file\r
+      // InstallAnywhere version will find build date this way\r
       // not entirely accurate as it only tells you when Cache.class was last compiled\r
-      java.net.URL url = Cache.class.getResource("/jalview/bin/Cache.class");\r
-      java.io.File f = new java.io.File(url.getFile());\r
-      date = f.lastModified();\r
+\r
+\r
+     java.io.File f = new java.io.File(System.getProperty("user.dir") + "/jalview/bin/Cache.class" );\r
+     date = f.lastModified();\r
     }\r
 \r
-    BUILD_DATE = new Date( date ).toString();\r
+    if(date!=0)\r
+      BUILD_DATE = new Date( date ).toString();\r
 \r
     applicationProperties = new Properties();\r
 \r