mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-07-30 07:18:37 -09:00
GP-7096 - Prevent headless analyzer from updating last opened project
This commit is contained in:
@@ -1859,7 +1859,27 @@ public class HeadlessAnalyzer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A headless version of the {@link DefaultProjectManager} that does not update the project's
|
||||
* preferences. This prevents the headless environment from overwriting settings GUI
|
||||
* installations.
|
||||
*/
|
||||
private static class HeadlessGhidraProjectManager extends DefaultProjectManager {
|
||||
// this exists just to allow access to the constructor
|
||||
|
||||
@Override
|
||||
public void setLastOpenedProject(ProjectLocator projectLocator) {
|
||||
// No need to save this for headless. We also do not want to affect the GUI by saving
|
||||
// this value.
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectLocator getLastOpenedProject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updatePreferences() {
|
||||
// nothing to save
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,20 +23,20 @@ import ghidra.framework.options.Options;
|
||||
*/
|
||||
public enum DefaultLaunchMode {
|
||||
|
||||
REUSE_TOOL("Reuse acceptable running tool"),
|
||||
NEW_TOOL("Launch new default tool");
|
||||
REUSE_TOOL("Reuse Tool"),
|
||||
NEW_TOOL("New Tool");
|
||||
|
||||
public static DefaultLaunchMode DEFAULT = NEW_TOOL;
|
||||
|
||||
private String str;
|
||||
private String description;
|
||||
|
||||
private DefaultLaunchMode(String str) {
|
||||
this.str = str;
|
||||
this.description = str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return str;
|
||||
return description;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -568,7 +568,7 @@ public class DefaultProjectManager implements ProjectManager {
|
||||
/**
|
||||
* Update preferences file with list of known projects.
|
||||
*/
|
||||
void updatePreferences() {
|
||||
protected void updatePreferences() {
|
||||
|
||||
setProjectLocatorProperty(recentlyOpenedProjectsList, RECENT_PROJECTS);
|
||||
setProjectURLProperty(recentlyViewedProjectsList, VIEWED_PROJECTS);
|
||||
|
||||
Reference in New Issue
Block a user