mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
Merge remote-tracking branch 'origin/GP-1484_Dan_fixAutoSaveTracesNameConflict'
This commit is contained in:
commit
a1dbb25260
1 changed files with 10 additions and 8 deletions
|
@ -953,13 +953,7 @@ public class DebuggerTraceManagerServicePlugin extends Plugin
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String filename = trace.getName();
|
|
||||||
DomainFolder root = tool.getProject().getProjectData().getRootFolder();
|
DomainFolder root = tool.getProject().getProjectData().getRootFolder();
|
||||||
DomainFile existing = root.getFile(filename);
|
|
||||||
for (int i = 1; existing != null; i++) {
|
|
||||||
filename = trace.getName() + "." + i;
|
|
||||||
existing = root.getFile(filename);
|
|
||||||
}
|
|
||||||
DomainFolder traces;
|
DomainFolder traces;
|
||||||
try {
|
try {
|
||||||
traces = createOrGetFolder(tool, "Save New Trace", root, NEW_TRACES_FOLDER_NAME);
|
traces = createOrGetFolder(tool, "Save New Trace", root, NEW_TRACES_FOLDER_NAME);
|
||||||
|
@ -968,12 +962,20 @@ public class DebuggerTraceManagerServicePlugin extends Plugin
|
||||||
throw new AssertionError(e);
|
throw new AssertionError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String finalFilename = filename;
|
|
||||||
new TaskLauncher(new Task("Save New Trace", true, true, true) {
|
new TaskLauncher(new Task("Save New Trace", true, true, true) {
|
||||||
@Override
|
@Override
|
||||||
public void run(TaskMonitor monitor) throws CancelledException {
|
public void run(TaskMonitor monitor) throws CancelledException {
|
||||||
|
String filename = trace.getName();
|
||||||
try (DomainObjectLockHold hold = maybeLock(trace, force)) {
|
try (DomainObjectLockHold hold = maybeLock(trace, force)) {
|
||||||
traces.createFile(finalFilename, trace, monitor);
|
for (int i = 1;; i++) {
|
||||||
|
try {
|
||||||
|
traces.createFile(filename, trace, monitor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch (DuplicateFileException e) {
|
||||||
|
filename = trace.getName() + "." + i;
|
||||||
|
}
|
||||||
|
}
|
||||||
trace.save("Initial save", monitor);
|
trace.save("Initial save", monitor);
|
||||||
future.complete(null);
|
future.complete(null);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue