Add default data dir property

This commit is contained in:
crschnick 2024-08-02 17:33:05 +00:00
parent ce5c06c124
commit 7390d3b25c

View file

@ -37,6 +37,7 @@ public class AppProperties {
boolean useVirtualThreads; boolean useVirtualThreads;
boolean debugThreads; boolean debugThreads;
Path dataDir; Path dataDir;
Path defaultDataDir;
boolean showcase; boolean showcase;
AppVersion canonicalVersion; AppVersion canonicalVersion;
boolean locatePtb; boolean locatePtb;
@ -87,6 +88,7 @@ public class AppProperties {
debugThreads = Optional.ofNullable(System.getProperty("io.xpipe.app.debugThreads")) debugThreads = Optional.ofNullable(System.getProperty("io.xpipe.app.debugThreads"))
.map(Boolean::parseBoolean) .map(Boolean::parseBoolean)
.orElse(false); .orElse(false);
defaultDataDir = Path.of(System.getProperty("user.home"), isStaging() ? ".xpipe-ptb" : ".xpipe");
dataDir = Optional.ofNullable(System.getProperty("io.xpipe.app.dataDir")) dataDir = Optional.ofNullable(System.getProperty("io.xpipe.app.dataDir"))
.map(s -> { .map(s -> {
var p = Path.of(s); var p = Path.of(s);
@ -95,7 +97,7 @@ public class AppProperties {
} }
return p; return p;
}) })
.orElse(Path.of(System.getProperty("user.home"), isStaging() ? ".xpipe-ptb" : ".xpipe")); .orElse(defaultDataDir);
showcase = Optional.ofNullable(System.getProperty("io.xpipe.app.showcase")) showcase = Optional.ofNullable(System.getProperty("io.xpipe.app.showcase"))
.map(Boolean::parseBoolean) .map(Boolean::parseBoolean)
.orElse(false); .orElse(false);