Package ghidra

# Class GhidraApplicationLayout

java.lang.Object
utility.application.ApplicationLayout
ghidra.GhidraApplicationLayout

Direct Known Subclasses:
  `GhidraJarApplicationLayout`, `GhidraTestApplicationLayout`

public class GhidraApplicationLayout extends ApplicationLayout
The Ghidra application layout defines the customizable elements of the Ghidra application's directory structure.

- ## Field Summary

  ### Fields inherited from class utility.application.ApplicationLayout

  `applicationInstallationDir, applicationProperties, applicationRootDirs, extensionArchiveDir, extensionInstallationDirs, modules, patchDir, userCacheDir, userSettingsDir, userTempDir`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GhidraApplicationLayout()`
  Constructs a new Ghidra application layout object.
  `GhidraApplicationLayout(File applicationInstallationDir)`
  Constructs a new Ghidra application layout object using a provided application installation directory instead of this layout's default.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected ResourceFile`
  `findExtensionArchiveDirectory()`
  Returns the directory where all Ghidra extension archives are stored.
  `protected List<ResourceFile>`
  `findExtensionInstallationDirectories()`
  Returns a prioritized list of directories where Ghidra extensions are installed.
  `protected ResourceFile`
  `findGhidraApplicationInstallationDir()`
  Finds the application installation directory for this Ghidra application layout.
  `protected Collection<ResourceFile>`
  `findGhidraApplicationRootDirs()`
  Finds the application root directories for this application layout.
  `protected Map<String,GModule>`
  `findGhidraModules()`
  Finds the modules for this Ghidra application layout.
  `protected ResourceFile`
  `findPatchDirectory()`
  Returns the directory that allows users to add jar and class files to override existing distribution files

  ### Methods inherited from class utility.application.ApplicationLayout

  `createUserDirs, getApplicationInstallationDir, getApplicationProperties, getApplicationRootDirs, getExtensionArchiveDir, getExtensionInstallationDirs, getModules, getPatchDir, getUserCacheDir, getUserSettingsDir, getUserTempDir, inSingleJarMode`

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

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

- ## Constructor Details

  - ### GhidraApplicationLayout

    public GhidraApplicationLayout() throws FileNotFoundException, IOException
    Constructs a new Ghidra application layout object.
    Throws:
      `FileNotFoundException` - if there was a problem getting a user directory.
      `IOException` - if there was a problem getting the application properties or modules.

  - ### GhidraApplicationLayout

    public GhidraApplicationLayout(File applicationInstallationDir) throws FileNotFoundException, IOException
    Constructs a new Ghidra application layout object using a provided application installation directory instead of this layout's default.

    This is used when something external to Ghidra needs Ghidra's layout (like the Eclipse GhidraDevPlugin).

    Parameters:
      `applicationInstallationDir` - The application installation directory.
    Throws:
      `FileNotFoundException` - if there was a problem getting a user directory.
      `IOException` - if there was a problem getting the application properties.

- ## Method Details

  - ### findGhidraApplicationRootDirs

    protected Collection<ResourceFile> findGhidraApplicationRootDirs()
    Finds the application root directories for this application layout.
    Returns:
      A collection of the application root directories for this layout.

  - ### findGhidraApplicationInstallationDir

    protected ResourceFile findGhidraApplicationInstallationDir()
    Finds the application installation directory for this Ghidra application layout.
    Returns:
      The application installation directory for this Ghidra application layout. Could be null if there is no application installation directory.

  - ### findGhidraModules

    protected Map<String,GModule> findGhidraModules() throws IOException
    Finds the modules for this Ghidra application layout.
    Returns:
      The modules for this Ghidra application layout.
    Throws:
      `IOException` - if there was a problem finding the modules on disk.

  - ### findPatchDirectory

    protected ResourceFile findPatchDirectory()
    Returns the directory that allows users to add jar and class files to override existing distribution files
    Returns:
      the patch dir; null if not in a distribution

  - ### findExtensionArchiveDirectory

    protected ResourceFile findExtensionArchiveDirectory()
    Returns the directory where all Ghidra extension archives are stored. This should be at the following location:
    - `{install dir}/Extensions/Ghidra`
    Returns:
      the archive folder, or null if can't be determined

  - ### findExtensionInstallationDirectories

    protected List<ResourceFile> findExtensionInstallationDirectories()
    Returns a prioritized list of directories where Ghidra extensions are installed. These should be at the following locations:
    - `[user settings dir]/Extensions`
    - `[application install dir]/Ghidra/Extensions` (Release Mode)
    - `ghidra/Ghidra/Extensions` (Development Mode)
    Returns:
      the install folder, or null if can't be determined