Ignore:
Timestamp:
2007-08-08T21:08:40+02:00 (18 years ago)
Author:
frsantos
Message:

Store version and build date in jar Manifest instead of REVISION file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/ywms/src/org/openstreetmap/josm/plugins/ywms/Util.java

    r3612 r4018  
    88import java.net.URLConnection;
    99import java.util.StringTokenizer;
    10 import java.util.regex.Matcher;
    11 import java.util.regex.Pattern;
    1210
    1311import javax.swing.JButton;
    1412
    1513import org.openstreetmap.josm.Main;
    16 import org.openstreetmap.josm.plugins.Plugin;
    17 import org.openstreetmap.josm.plugins.PluginProxy;
     14import org.openstreetmap.josm.plugins.*;
    1815import org.openstreetmap.josm.tools.ImageProvider;
    1916
     
    8178        public static Version getVersion()
    8279    {
    83         String revision;
    84         try
    85         {
    86                         revision = loadFile(Util.class.getResource("/resources/REVISION"));
    87                 }
    88         catch (Exception e)
    89         {
    90                         return null;
    91                 }
    92 
    93                 Pattern versionPattern = Pattern.compile(".*?Revision: ([0-9]*).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL);
    94                 Matcher match = versionPattern.matcher(revision);
    95                 String version = match.matches() ? match.group(1) : "UNKNOWN";
    96 
    97                 Pattern timePattern = Pattern.compile(".*?Last Changed Date: ([^\n]*).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL);
    98                 match = timePattern.matcher(revision);
    99                 String time = match.matches() ? match.group(1) : "UNKNOWN";
    100                
    101                 return new Version(version, time);
     80        PluginInformation info = PluginInformation.getLoaded("ywms");
     81        if( info == null )
     82            return null;
     83
     84        return new Version(info.version, info.attr.get("Plugin-Date"));
    10285    }
    10386
Note: See TracChangeset for help on using the changeset viewer.