mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
GP-5633: Fixed a bug that prevented new installations of Ghidra from
applying preferences found in older installed versions of Ghidra
This commit is contained in:
parent
f0a327ff11
commit
d2d3590d28
1 changed files with 9 additions and 7 deletions
|
@ -47,15 +47,15 @@ public class GenericRunInfo {
|
||||||
File userSettingsDirectory = Application.getUserSettingsDirectory();
|
File userSettingsDirectory = Application.getUserSettingsDirectory();
|
||||||
|
|
||||||
List<File> appDirs =
|
List<File> appDirs =
|
||||||
collectAllApplicationDirectories(userSettingsDirectory.getParentFile());
|
collectAllApplicationDirectories(userSettingsDirectory.getParentFile(), false);
|
||||||
|
|
||||||
// Search "legacy" user setting directory locations in case the user has upgraded from an
|
// Search "legacy" user setting directory locations in case the user has upgraded from an
|
||||||
// older version
|
// older version
|
||||||
try {
|
try {
|
||||||
File legacyUserSettingsDirectory = ApplicationUtilities.getLegacyUserSettingsDir(
|
File legacyUserSettingsDirectory = ApplicationUtilities.getLegacyUserSettingsDir(
|
||||||
layout.getApplicationProperties(), layout.getApplicationInstallationDir());
|
layout.getApplicationProperties(), layout.getApplicationInstallationDir());
|
||||||
appDirs.addAll(
|
appDirs.addAll(collectAllApplicationDirectories(
|
||||||
collectAllApplicationDirectories(legacyUserSettingsDirectory.getParentFile()));
|
legacyUserSettingsDirectory.getParentFile(), true));
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException e) {
|
catch (FileNotFoundException e) {
|
||||||
// ignore
|
// ignore
|
||||||
|
@ -92,9 +92,11 @@ public class GenericRunInfo {
|
||||||
return appDirs;
|
return appDirs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<File> collectAllApplicationDirectories(File dataDirectoryParentDir) {
|
private static List<File> collectAllApplicationDirectories(File dataDirectoryParentDir,
|
||||||
|
boolean legacy) {
|
||||||
|
|
||||||
String settingsDirPrefix = "." + Application.getName().replaceAll("\\s", "").toLowerCase();
|
String appName = Application.getName().replaceAll("\\s", "").toLowerCase();
|
||||||
|
String settingsDirPrefix = (legacy ? "." : "") + appName;
|
||||||
FileFilter userDirFilter = f -> {
|
FileFilter userDirFilter = f -> {
|
||||||
String name = f.getName();
|
String name = f.getName();
|
||||||
return f.isDirectory() && name.startsWith(settingsDirPrefix) &&
|
return f.isDirectory() && name.startsWith(settingsDirPrefix) &&
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue