Ticket #1841: josm-1841-manifest_lookup.patch
File josm-1841-manifest_lookup.patch, 1.5 KB (added by , 15 years ago) |
---|
-
src/org/openstreetmap/josm/actions/AboutAction.java
12 12 import java.io.IOException; 13 13 import java.io.InputStream; 14 14 import java.io.InputStreamReader; 15 import java.net.MalformedURLException; 15 16 import java.net.URL; 16 17 import java.util.Map.Entry; 17 18 import java.util.regex.Matcher; … … 50 51 private final static JTextArea revision; 51 52 private static String time; 52 53 53 static { 54 URL u = Main.class.getResource("/REVISION"); 55 if(u == null) u = Main.class.getResource("/META-INF/MANIFEST.MF"); 54 static { 55 URL u = Main.class.getResource("/REVISION"); 56 if(u == null) { 57 try { 58 u = new URL("jar:" + Main.class.getProtectionDomain().getCodeSource().getLocation().toString() 59 + "!/META-INF/MANIFEST.MF"); 60 } catch (MalformedURLException e) { 61 e.printStackTrace(); 62 } 63 } 56 64 revision = loadFile(u); 57 65 58 Pattern versionPattern = Pattern.compile(".*?(?:Revision|Main-Version): ([0-9]* ).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL);66 Pattern versionPattern = Pattern.compile(".*?(?:Revision|Main-Version): ([0-9]*(?: SVN)?).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); 59 67 Matcher match = versionPattern.matcher(revision.getText()); 60 68 version = match.matches() ? match.group(1) : tr("UNKNOWN"); 61 69