mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-07 09:11:15 -09:00
GP-4065: Headless -recusive depth now defaults to 1 if importing a file
This commit is contained in:
@@ -1656,10 +1656,13 @@ public class HeadlessAnalyzer {
|
||||
messageLog, TaskMonitor.DUMMY);
|
||||
}
|
||||
|
||||
private void processWithImport(FSRL fsrl, String folderPath, int depth, boolean isFirstTime)
|
||||
private void processWithImport(FSRL fsrl, String folderPath, Integer depth, boolean isFirstTime)
|
||||
throws IOException {
|
||||
try (RefdFile refdFile = fsService.getRefdFile(fsrl, TaskMonitor.DUMMY)) {
|
||||
GFile file = refdFile.file;
|
||||
if (depth == null && isFirstTime) {
|
||||
depth = file.isDirectory() ? 0 : 1; // set default depth
|
||||
}
|
||||
if ((options.recursive || isFirstTime) && file.isDirectory()) {
|
||||
processFS(file.getFilesystem(), file, folderPath, depth);
|
||||
return;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class HeadlessOptions {
|
||||
|
||||
// -recursive
|
||||
boolean recursive;
|
||||
int recursiveDepth;
|
||||
Integer recursiveDepth; // 'null' means use default depth, which is different for files vs dirs
|
||||
|
||||
// -readOnly
|
||||
boolean readOnly;
|
||||
@@ -130,7 +130,7 @@ public class HeadlessOptions {
|
||||
propertiesFilePaths = new ArrayList<>();
|
||||
overwrite = false;
|
||||
recursive = false;
|
||||
recursiveDepth = 0;
|
||||
recursiveDepth = null;
|
||||
readOnly = false;
|
||||
deleteProject = false;
|
||||
analyze = true;
|
||||
@@ -343,9 +343,7 @@ public class HeadlessOptions {
|
||||
*/
|
||||
public void enableRecursiveProcessing(boolean enabled, Integer depth) {
|
||||
this.recursive = enabled;
|
||||
if (depth != null) {
|
||||
this.recursiveDepth = depth;
|
||||
}
|
||||
this.recursiveDepth = depth;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -404,9 +404,10 @@ The Headless Analyzer uses the command-line parameters discussed below. See <a h
|
||||
Specifying a positive integer value for the optional <typewriter><depth></typewriter>
|
||||
argument enables recursive descent into supported container files (e.g., zip, tar, .a, etc).
|
||||
The depth value only applies to nested container files. Intermediate directories found within
|
||||
each nested container file are not affected by the specified depth value. Specifying a depth
|
||||
value of 0 has the same effect as not specifying any depth value (i.e., container files will not be recursed into).
|
||||
</LI>
|
||||
each nested container file are not affected by the specified depth value. If a depth value is
|
||||
not specified, it will default to 0 if importing a directory, and 1 if importing a file. A
|
||||
depth of 0 will prevent recursing into any container files.
|
||||
</LI>
|
||||
|
||||
<br><br>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user