Package utility.application

# Class ApplicationLayout

java.lang.Object
utility.application.ApplicationLayout

Direct Known Subclasses:
  `DummyApplicationLayout`, `GenericApplicationLayout`, `GhidraApplicationLayout`

public abstract class ApplicationLayout extends Object
The Application Layout base class defines the customizable elements of the application's directory structure. Create a subclass to define a custom layout.

If a layout changes in a significant way, the `ApplicationProperties.APPLICATION_LAYOUT_VERSION_PROPERTY` should be incremented so external things like Eclipse GhidraDev know to look in different places for things.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected ResourceFile`
  `applicationInstallationDir`
  `protected ApplicationProperties`
  `applicationProperties`
  `protected Collection<ResourceFile>`
  `applicationRootDirs`
  `protected ResourceFile`
  `extensionArchiveDir`
  `protected List<ResourceFile>`
  `extensionInstallationDirs`
  `protected Map<String,GModule>`
  `modules`
  `protected ResourceFile`
  `patchDir`
  `protected File`
  `userCacheDir`
  `protected File`
  `userSettingsDir`
  `protected File`
  `userTempDir`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ApplicationLayout()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final void`
  `createUserDirs()`
  Creates the application's user directories (or ensures they already exist).
  `final ResourceFile`
  `getApplicationInstallationDir()`
  Gets the application installation directory from the application layout.
  `final ApplicationProperties`
  `getApplicationProperties()`
  Gets the application properties from the application layout
  `final Collection<ResourceFile>`
  `getApplicationRootDirs()`
  Gets the application root directories from the application layout.
  `final ResourceFile`
  `getExtensionArchiveDir()`
  Returns the directory where archived application Extensions are stored.
  `final List<ResourceFile>`
  `getExtensionInstallationDirs()`
  Returns a prioritized `ordered list` of the application Extensions installation directories.
  `final Map<String,GModule>`
  `getModules()`
  Gets the application's modules from the application layout.
  `final ResourceFile`
  `getPatchDir()`
  Returns the location of the application patch directory.
  `final File`
  `getUserCacheDir()`
  Gets the user cache directory from the application layout.
  `final File`
  `getUserSettingsDir()`
  Gets the user settings directory from the application layout.
  `final File`
  `getUserTempDir()`
  Gets the user temp directory from the application layout.
  `boolean`
  `inSingleJarMode()`
  Checks whether or not the application is using a "single jar" layout.

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

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

- ## Field Details

  - ### applicationProperties

    protected ApplicationProperties applicationProperties

  - ### applicationRootDirs

    protected Collection<ResourceFile> applicationRootDirs

  - ### applicationInstallationDir

    protected ResourceFile applicationInstallationDir

  - ### modules

    protected Map<String,GModule> modules

  - ### userTempDir

    protected File userTempDir

  - ### userCacheDir

    protected File userCacheDir

  - ### userSettingsDir

    protected File userSettingsDir

  - ### patchDir

    protected ResourceFile patchDir

  - ### extensionArchiveDir

    protected ResourceFile extensionArchiveDir

  - ### extensionInstallationDirs

    protected List<ResourceFile> extensionInstallationDirs

- ## Constructor Details

  - ### ApplicationLayout

    public ApplicationLayout()

- ## Method Details

  - ### getApplicationProperties

    public final ApplicationProperties getApplicationProperties()
    Gets the application properties from the application layout
    Returns:
      The application properties. Should never be null.

  - ### getApplicationRootDirs

    public final Collection<ResourceFile> getApplicationRootDirs()
    Gets the application root directories from the application layout.
    Returns:
      A collection of application root directories (or null if not set).

  - ### getApplicationInstallationDir

    public final ResourceFile getApplicationInstallationDir()
    Gets the application installation directory from the application layout.
    Returns:
      The application installation directory (or null if not set).

  - ### getModules

    public final Map<String,GModule> getModules()
    Gets the application's modules from the application layout.
    Returns:
      The application's modules as a map (mapping module name to module for convenience).

  - ### getUserTempDir

    public final File getUserTempDir()
    Gets the user temp directory from the application layout.
    Returns:
      The user temp directory (or null if not set).

  - ### getUserCacheDir

    public final File getUserCacheDir()
    Gets the user cache directory from the application layout.
    Returns:
      The user cache directory (or null if not set).

  - ### getUserSettingsDir

    public final File getUserSettingsDir()
    Gets the user settings directory from the application layout.
    Returns:
      The user settings directory (or null if not set).

  - ### getExtensionArchiveDir

    public final ResourceFile getExtensionArchiveDir()
    Returns the directory where archived application Extensions are stored. This directory may contain both zip files and subdirectories. This directory is only used inside of an installation; development mode does not use this directory. This directory is used to ship pre-built Ghidra extensions as part of a distribution.

    This should be at the following location:

    - `{install dir}/Extensions/Ghidra`
    Returns:
      the application Extensions archive directory. Could be null if the `ApplicationLayout` does not support application Extensions.

  - ### getExtensionInstallationDirs

    public final List<ResourceFile> getExtensionInstallationDirs()
    Returns a prioritized `ordered list` of the application Extensions installation directories. Typically, the values may be any of the following locations:
    - `[user settings dir]/Extensions`
    - `[application install dir]/Ghidra/Extensions` (Release Mode)
    - `ghidra/Ghidra/Extensions` (Development Mode)
    Returns:
      an `ordered list` of the application Extensions installation directories. Could be empty if the `ApplicationLayout` does not support application Extensions.

  - ### getPatchDir

    public final ResourceFile getPatchDir()
    Returns the location of the application patch directory. The patch directory can be used to modify existing code within a distribution.
    Returns:
      the patch directory; may be null

  - ### createUserDirs

    public final void createUserDirs() throws IOException
    Creates the application's user directories (or ensures they already exist).
    Throws:
      `IOException` - if there was a problem creating the application's user directories.

  - ### inSingleJarMode

    public boolean inSingleJarMode()
    Checks whether or not the application is using a "single jar" layout. Custom application layouts that extend this class can override this method once they determine they are in single jar mode.
    Returns:
      true if the application is using a "single jar" layout; otherwise, false.