Skip to content

Commit

Permalink
Desktop: Add --data-dir argument
Browse files Browse the repository at this point in the history
We can override the default data directory by providing --data-dir as
an argument. This will be used in the regtest setup.
  • Loading branch information
alvasw committed Mar 15, 2022
1 parent ee64ab2 commit 3334d5f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,18 @@ public static ApplicationConfig getConfig(Config typesafeConfig, String[] args)
appName = typesafeConfig.getString("appName");
}

String dataDir = null;
boolean isBitcoindRegtest = false;
boolean isElementsdRegtest = false;
for (String arg : args) {
if (arg.startsWith("--appName")) {
appName = arg.split("=")[1];
}

if (arg.startsWith("--data-dir")) {
dataDir = arg.split("=")[1];
}

if (arg.startsWith("--regtest-bitcoind")) {
isBitcoindRegtest = true;
}
Expand All @@ -49,8 +54,9 @@ public static ApplicationConfig getConfig(Config typesafeConfig, String[] args)
}
}

String appDir = OsUtils.getUserDataDir() + File.separator + appName;
String appDir = dataDir == null ? OsUtils.getUserDataDir() + File.separator + appName : dataDir;
log.info("Use application directory {}", appDir);

return new ApplicationConfig(appDir, appName, isBitcoindRegtest, isElementsdRegtest);
}
}

0 comments on commit 3334d5f

Please sign in to comment.