mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
GT-3283 - minor code cleanup
This commit is contained in:
parent
3051601206
commit
6add90470d
4 changed files with 26 additions and 9 deletions
|
@ -155,38 +155,44 @@ public class GenericRunInfo {
|
|||
|
||||
/**
|
||||
* This is the same as {@link #getUserSettingsDirsByTime()} except that it doesn't include the
|
||||
* current installation or installations with different release names.
|
||||
* current installation or installations with different release names
|
||||
*
|
||||
* @return the list of previous directories, sorted by time
|
||||
*/
|
||||
public static List<File> getPreviousApplicationSettingsDirsByTime() {
|
||||
List<File> applicationSettiingsDirs = new ArrayList<>();
|
||||
List<File> settingsDirs = new ArrayList<>();
|
||||
|
||||
ApplicationIdentifier myIdentifier = new ApplicationIdentifier(
|
||||
Application.getApplicationLayout().getApplicationProperties());
|
||||
String myRelease = myIdentifier.getApplicationReleaseName();
|
||||
String myDirName = Application.getUserSettingsDirectory().getName();
|
||||
|
||||
for (File dir : getUserSettingsDirsByTime()) {
|
||||
String dirName = dir.getName();
|
||||
|
||||
// Ignore the currently active user settings directory.
|
||||
// By definition, it is not a previous one.
|
||||
if (dirName.equals(Application.getUserSettingsDirectory().getName())) {
|
||||
String dirName = dir.getName();
|
||||
if (dirName.equals(myDirName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dirName.startsWith(".")) {
|
||||
dirName = dirName.substring(1);
|
||||
}
|
||||
|
||||
try {
|
||||
// The current release name has to match for it to be considered
|
||||
if (new ApplicationIdentifier(dirName).getApplicationReleaseName().equals(
|
||||
myIdentifier.getApplicationReleaseName())) {
|
||||
applicationSettiingsDirs.add(dir);
|
||||
// The current release name has to match for it to be considered
|
||||
ApplicationIdentifier identifier = new ApplicationIdentifier(dirName);
|
||||
String release = identifier.getApplicationReleaseName();
|
||||
if (release.equals(myRelease)) {
|
||||
settingsDirs.add(dir);
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
// The directory name didn't contain a valid application identifier...skip it
|
||||
}
|
||||
}
|
||||
return applicationSettiingsDirs;
|
||||
return settingsDirs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue