Package ghidra.framework.model
Class ProjectDataUtils
- java.lang.Object
-
- ghidra.framework.model.ProjectDataUtils
-
public class ProjectDataUtils extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProjectDataUtils.DomainFileIterator
A not-thread-safeDomainFile
iterator that recursively walks aproject's data
and returns eachDomainFile
that is found.static class
ProjectDataUtils.DomainFolderIterator
A not-thread-safeDomainFolder
iterator that recursively walks aproject's data
and returns eachDomainFolder
that is found.
-
Constructor Summary
Constructors Constructor Description ProjectDataUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DomainFolder
createDomainFolderPath(DomainFolder currentFolder, java.lang.String path)
Returns a GhidraDomainFolder
with the matching path, creating any missing parent folders as needed.static java.lang.Iterable<DomainFile>
descendantFiles(DomainFolder folder)
static java.lang.Iterable<DomainFolder>
descendantFolders(DomainFolder folder)
static java.lang.String
getUniqueName(DomainFolder folder, java.lang.String baseName)
Returns a unique name in a GhidraDomainFolder
.static DomainFolder
lookupDomainPath(DomainFolder currentFolder, java.lang.String path)
Returns a GhidraDomainFolder
with the matching path, or null if not found.
-
-
-
Method Detail
-
descendantFiles
public static java.lang.Iterable<DomainFile> descendantFiles(DomainFolder folder)
- Parameters:
folder
-- Returns:
-
descendantFolders
public static java.lang.Iterable<DomainFolder> descendantFolders(DomainFolder folder)
- Parameters:
folder
-- Returns:
-
createDomainFolderPath
public static DomainFolder createDomainFolderPath(DomainFolder currentFolder, java.lang.String path) throws InvalidNameException, java.io.IOException
Returns a GhidraDomainFolder
with the matching path, creating any missing parent folders as needed.- Parameters:
currentFolder
- startingDomainFolder
.path
- relative path to the desired DomainFolder, using forward slashes as separators. Empty string ok, multiple slashes in a row treated as single slash, trailing slashes ignored.- Returns:
DomainFolder
that the path points to.- Throws:
InvalidNameException
- if bad namejava.io.IOException
- if problem when creating folder
-
lookupDomainPath
public static DomainFolder lookupDomainPath(DomainFolder currentFolder, java.lang.String path)
Returns a GhidraDomainFolder
with the matching path, or null if not found.- Parameters:
currentFolder
- startingDomainFolder
.path
- relative path to the desired DomainFolder, using forward slashes as separators. Empty string ok, multiple slashes in a row treated as single slash, trailing slashes ignored.- Returns:
DomainFolder
that the path points to or null if not found.
-
getUniqueName
public static java.lang.String getUniqueName(DomainFolder folder, java.lang.String baseName)
Returns a unique name in a GhidraDomainFolder
.- Parameters:
folder
-DomainFolder
to check for child name collisions.baseName
- String base name of the file or folder- Returns:
- "baseName" if no collisions, or "baseNameNNN" (where NNN is an incrementing integer value) when collisions are found, or null if there are more than 1000 collisions.
-
-