mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Use Version.properties to store version information, instead of Bundle.properties that is a tracked file.
This commit is contained in:
parent
e1857a7647
commit
fe8ce51961
2
.gitignore
vendored
2
.gitignore
vendored
@ -22,7 +22,7 @@ Bundle_*.properties
|
||||
genfiles.properties
|
||||
/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties
|
||||
/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties
|
||||
/CoreUtils/src/org/sleuthkit/autopsy/coreutils/Bundle.properties
|
||||
/CoreUtils/src/org/sleuthkit/autopsy/coreutils/Version.properties
|
||||
/Testing/script/input/
|
||||
/Testing/script/output/
|
||||
/Testing/script/gold/
|
||||
|
@ -18,29 +18,72 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.coreutils;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author dfickling
|
||||
* Utility to get version and build settings set at build time
|
||||
*/
|
||||
public class Version {
|
||||
|
||||
private Version() { }
|
||||
private static Properties versionProperties;
|
||||
|
||||
private Version() {
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
|
||||
RELEASE, DEVELOPMENT;
|
||||
}
|
||||
|
||||
private static void loadVersionProperty() {
|
||||
if (versionProperties != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
versionProperties = new Properties();
|
||||
try {
|
||||
InputStream inputStream = Version.class.getResourceAsStream("Version.properties");
|
||||
versionProperties.load(inputStream);
|
||||
} catch (IOException e) {
|
||||
versionProperties = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static String getVersionProperty(String property) {
|
||||
loadVersionProperty();
|
||||
if (versionProperties == null) {
|
||||
return "";
|
||||
} else {
|
||||
return versionProperties.getProperty(property);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the application version as set at build time
|
||||
* @return application version string
|
||||
*/
|
||||
public static String getVersion() {
|
||||
return NbBundle.getMessage(Version.class, "app.version");
|
||||
return getVersionProperty("app.version");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the application name as set at build time
|
||||
* @return the application name string
|
||||
*/
|
||||
public static String getName() {
|
||||
return NbBundle.getMessage(Version.class, "app.name");
|
||||
return getVersionProperty("app.name");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the application build type as set at build time
|
||||
* @return the application build type
|
||||
*/
|
||||
public static Version.Type getBuildType() {
|
||||
return Type.valueOf(NbBundle.getMessage(Version.class, "build.type"));
|
||||
String valueProp = getVersionProperty("build.type");
|
||||
return Type.valueOf(valueProp);
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,7 @@
|
||||
</propertyfile>
|
||||
|
||||
<propertyfile
|
||||
file="${basedir}/CoreUtils/src/org/sleuthkit/autopsy/coreutils/Bundle.properties"
|
||||
file="${basedir}/CoreUtils/src/org/sleuthkit/autopsy/coreutils/Version.properties"
|
||||
comment="Updated by build script">
|
||||
<entry key="app.name" value="${app.title}" />
|
||||
<entry key="app.version" value="${app.version}" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user