diff --git a/GhidraBuild/LaunchSupport/src/main/java/ghidra/launch/AppConfig.java b/GhidraBuild/LaunchSupport/src/main/java/ghidra/launch/AppConfig.java index 769dc37447..fe3a999558 100644 --- a/GhidraBuild/LaunchSupport/src/main/java/ghidra/launch/AppConfig.java +++ b/GhidraBuild/LaunchSupport/src/main/java/ghidra/launch/AppConfig.java @@ -402,6 +402,7 @@ public class AppConfig { userSettingsDirName += "_location_" + dirName; } + // Ensure there is a user home directory (there definitely should be) String userHomeDirPath = System.getProperty("user.home"); if (userHomeDirPath == null || userHomeDirPath.isEmpty()) { @@ -420,6 +421,20 @@ public class AppConfig { return new File(userSettingsDir, saveFileName); } + // Handle application.settingsdir system property + for (String arg : launchProperties.getVmArgList()) { + if (arg.startsWith("-Dapplication.settingsdir")) { + String[] parts = arg.split("=", 2); + if (parts.length == 2) { + String path = parts[1].trim(); + if (!path.isEmpty()) { + userSettingsDir = new File(path, appName + "/" + userSettingsDirName); + return new File(userSettingsDir, saveFileName); + } + } + } + } + // Look for XDG environment variable String xdgConfigHomeDirStr = System.getenv("XDG_CONFIG_HOME"); if (xdgConfigHomeDirStr != null && !xdgConfigHomeDirStr.isEmpty()) {