Package ghidra.framework.model

# Class ProjectDataUtils

java.lang.Object
ghidra.framework.model.ProjectDataUtils

public class ProjectDataUtils extends Object

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `ProjectDataUtils.DomainFileIterator`
  A not-thread-safe `DomainFile` iterator that recursively walks a `project's data` and returns each `DomainFile` that is found.
  `static class`
  `ProjectDataUtils.DomainFolderIterator`
  A not-thread-safe `DomainFolder` iterator that recursively walks a `project's data` and returns each `DomainFolder` that is found.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ProjectDataUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static DomainFolder`
  `createDomainFolderPath(DomainFolder currentFolder, String path)`
  Returns a Ghidra `DomainFolder` with the matching path, creating any missing parent folders as needed.
  `static Iterable<DomainFile>`
  `descendantFiles(DomainFolder folder)`
  Returns a `Iterable` sequence of all the `DomainFile`s that exist under the specified `folder`.
  `static Iterable<DomainFolder>`
  `descendantFolders(DomainFolder folder)`
  Returns a `Iterable` sequence of all the `DomainFolder`s that exist under the specified `folder`.
  `static String`
  `getUniqueName(DomainFolder folder, String baseName)`
  Returns a unique name in a Ghidra `DomainFolder`.
  `static DomainFolder`
  `lookupDomainPath(DomainFolder currentFolder, String path)`
  Returns a Ghidra `DomainFolder` with the matching path, or null if not found.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ProjectDataUtils

    public ProjectDataUtils()

- ## Method Details

  - ### descendantFiles

    public static Iterable<DomainFile> descendantFiles(DomainFolder folder)
    Returns a `Iterable` sequence of all the `DomainFile`s that exist under the specified `folder`.
    Parameters:
      `folder` -
    Returns:

  - ### descendantFolders

    public static Iterable<DomainFolder> descendantFolders(DomainFolder folder)
    Returns a `Iterable` sequence of all the `DomainFolder`s that exist under the specified `folder`.
    Parameters:
      `folder` -
    Returns:

  - ### createDomainFolderPath

    public static DomainFolder createDomainFolderPath(DomainFolder currentFolder, String path) throws InvalidNameException, IOException
    Returns a Ghidra `DomainFolder` with the matching path, creating any missing parent folders as needed.

    Parameters:
      `currentFolder` - starting `DomainFolder`.
      `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 name
      `IOException` - if problem when creating folder

  - ### lookupDomainPath

    public static DomainFolder lookupDomainPath(DomainFolder currentFolder, String path)
    Returns a Ghidra `DomainFolder` with the matching path, or null if not found.

    Parameters:
      `currentFolder` - starting `DomainFolder`.
      `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 String getUniqueName(DomainFolder folder, String baseName)
    Returns a unique name in a Ghidra `DomainFolder`.
    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.