* hardcode update revision number (because reading rev from manifest seems to be a very fragile solution)
This commit is contained in:
parent
5e2926bed5
commit
f9f7124ed7
|
@ -8,9 +8,6 @@ import java.awt.GraphicsEnvironment;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import java.util.jar.Manifest;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import java.util.prefs.BackingStoreException;
|
import java.util.prefs.BackingStoreException;
|
||||||
import java.util.prefs.Preferences;
|
import java.util.prefs.Preferences;
|
||||||
|
|
||||||
|
@ -33,6 +30,11 @@ public final class Settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static int getApplicationRevisionNumber() {
|
||||||
|
return Integer.parseInt(getApplicationProperty("application.revision"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getApplicationProperty(String key) {
|
public static String getApplicationProperty(String key) {
|
||||||
return ResourceBundle.getBundle(Settings.class.getName(), Locale.ROOT).getString(key);
|
return ResourceBundle.getBundle(Settings.class.getName(), Locale.ROOT).getString(key);
|
||||||
}
|
}
|
||||||
|
@ -142,18 +144,6 @@ public final class Settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static int getApplicationRevisionNumber() {
|
|
||||||
try {
|
|
||||||
Manifest manifest = new Manifest(Settings.class.getResourceAsStream("/META-INF/MANIFEST.MF"));
|
|
||||||
String rev = manifest.getMainAttributes().getValue("Built-Revision");
|
|
||||||
return Integer.parseInt(rev);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.getLogger(Settings.class.getName()).log(Level.WARNING, e.getMessage());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static String getApplicationIdentifier() {
|
public static String getApplicationIdentifier() {
|
||||||
return joinBy(" ", getApplicationName(), getApplicationVersion(), String.format("(r%s)", getApplicationRevisionNumber()));
|
return joinBy(" ", getApplicationName(), getApplicationVersion(), String.format("(r%s)", getApplicationRevisionNumber()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# application settings
|
# application settings
|
||||||
application.name: FileBot
|
application.name: FileBot
|
||||||
application.version: 2.5
|
application.version: 2.5
|
||||||
|
application.revision: 905
|
||||||
|
|
||||||
# application updates
|
# application updates
|
||||||
update.url = http://filebot.sourceforge.net/update.xml
|
update.url = http://filebot.sourceforge.net/update.xml
|
||||||
|
|
Loading…
Reference in New Issue