diff --git a/src/main/java/io/github/albertus82/acodec/gui/config/ApplicationConfig.java b/src/main/java/io/github/albertus82/acodec/gui/config/ApplicationConfig.java index 7604931..82dd905 100644 --- a/src/main/java/io/github/albertus82/acodec/gui/config/ApplicationConfig.java +++ b/src/main/java/io/github/albertus82/acodec/gui/config/ApplicationConfig.java @@ -17,11 +17,22 @@ public class ApplicationConfig extends Configuration { - private static final String DIRECTORY_NAME = Util.isLinux() ? '.' + BuildInfo.getProperty("project.artifactId") : BuildInfo.getProperty("project.name"); + private static final String DIRECTORY_NAME; + private static final String CFG_FILE_NAME = BuildInfo.getProperty("project.groupId") + '.' + BuildInfo.getProperty("project.artifactId") + ".cfg"; - public static final String APPDATA_DIRECTORY = SystemUtils.getOsSpecificLocalAppDataDir() + File.separator + DIRECTORY_NAME; + static { + if (Util.isLinux()) { + DIRECTORY_NAME = '.' + BuildInfo.getProperty("project.artifactId"); + } + else if (Util.isMac()) { + DIRECTORY_NAME = ""; + } + else { + DIRECTORY_NAME = BuildInfo.getProperty("project.name"); + } + } - private static final String CFG_FILE_NAME = (Util.isLinux() ? BuildInfo.getProperty("project.artifactId") : BuildInfo.getProperty("project.name").replace(" ", "")) + ".cfg"; + public static final String APPDATA_DIRECTORY = SystemUtils.getOsSpecificLocalAppDataDir() + File.separator + DIRECTORY_NAME; private static volatile ApplicationConfig instance; // NOSONAR Use a thread-safe type; adding "volatile" is not enough to make this field thread-safe. Use a thread-safe type; adding "volatile" is not enough to make this field thread-safe. private static volatile IPreferencesConfiguration wrapper; // NOSONAR Use a thread-safe type; adding "volatile" is not enough to make this field thread-safe. Use a thread-safe type; adding "volatile" is not enough to make this field thread-safe. diff --git a/src/main/resources/io/github/albertus82/acodec/common/util/build-info.properties b/src/main/resources/io/github/albertus82/acodec/common/util/build-info.properties index 748f11c..b68f893 100644 --- a/src/main/resources/io/github/albertus82/acodec/common/util/build-info.properties +++ b/src/main/resources/io/github/albertus82/acodec/common/util/build-info.properties @@ -1,4 +1,5 @@ +project.groupId=${project.groupId} project.artifactId=${project.artifactId} -project.name=${project.name} project.version=${project.version} +project.name=${project.name} version.timestamp=${git.commit.time} diff --git a/src/test/java/io/github/albertus82/acodec/common/util/BuildInfoTest.java b/src/test/java/io/github/albertus82/acodec/common/util/BuildInfoTest.java index 2a24251..1210d14 100644 --- a/src/test/java/io/github/albertus82/acodec/common/util/BuildInfoTest.java +++ b/src/test/java/io/github/albertus82/acodec/common/util/BuildInfoTest.java @@ -10,7 +10,7 @@ class BuildInfoTest { - private static final Collection expectedPropertyNames = Arrays.asList("project.artifactId", "project.name", "project.version", "version.timestamp"); + private static final Collection expectedPropertyNames = Arrays.asList("project.groupId", "project.artifactId", "project.version", "project.name", "version.timestamp"); @Test void testApi() {