Package ghidra.framework.model

# Interface LinkFileInfo

All Known Implementing Classes:
  `GhidraFile`

public interface LinkFileInfo
`LinkFileInfo` provides access to link details for a `DomainFile` which is a link-file.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getAbsoluteLinkPath()`
  Get the stored link-path as a Ghidra URL or absolute normalized link-path from a link file.
  `DomainFile`
  `getFile()`
  Returns the file that is associated with this link information..
  `LinkedGhidraFolder`
  `getLinkedFolder()`
  If this is a folder-link file get the corresponding linked folder.
  `String`
  `getLinkPath()`
  Get the stored link-path.
  `default LinkHandler.LinkStatus`
  `getLinkStatus(Consumer<String> errorConsumer)`
  Determine the link status.
  `default boolean`
  `isExternalLink()`
  Determine if the link "directly" refers to an external resource (i.e., URL-based `link path`).
  `default boolean`
  `isFolderLink()`
  Returns true if this file is a folder-link, else false..

- ## Method Details

  - ### getFile

    DomainFile getFile()
    Returns the file that is associated with this link information..
    Returns:
      the file that is associated with this link information.

  - ### isExternalLink

    default boolean isExternalLink()
    Determine if the link "directly" refers to an external resource (i.e., URL-based `link path`).

    NOTE: It is important to understand that if this method returns `false` it may link to another link that is external. If the a file external status is required an `LinkHandler.LinkStatus.EXTERNAL` status should be checked using `getLinkStatus(Consumer)`.

    Returns:
      true if link-path is URL-based, else false

  - ### isFolderLink

    default boolean isFolderLink()
    Returns true if this file is a folder-link, else false..
    Returns:
      true if this file is a folder-link, else false.

  - ### getLinkedFolder

    LinkedGhidraFolder getLinkedFolder()
    If this is a folder-link file get the corresponding linked folder. Invoking this method on an `external-link` will cause the associated project or repository to be opened and associated with the active project as a a viewed-project. The resulting folder instance will return true to the method `DomainFolder.isLinked()`. NOTE: This method will recurse all internal folder-links which may be chained together and relies on link status checks to prevent possible recursion (See `LinkHandler.getLinkFileStatus(DomainFile, Consumer)`).
    Returns:
      a linked domain folder or null if not a valid folder-link.

  - ### getLinkPath

    String getLinkPath()
    Get the stored link-path. This may be either be an absolute or relative path within the link-file's project or a Ghidra URL.

    If you want to ensure that a project path returned is absolute and normalized, then `getAbsoluteLinkPath()` may be used. If this corresponds to a link-file that implements `LinkedDomainFile` the absolute path form must be used to avoid treating as relative to the incorrect parent folder. A `LinkedDomainFile` can occur when the link-file exists within a linked-folder or subfolder.

    Returns:
      associated link path

  - ### getAbsoluteLinkPath

    String getAbsoluteLinkPath() throws IOException
    Get the stored link-path as a Ghidra URL or absolute normalized link-path from a link file. Path normalization eliminates any path element of "./" or "../". A local folder-link path will always end with a "/" path separator. Path normalization is not performed on Ghidra URLs.
    Returns:
      Ghidra URL or absolute normalized link-path from a link file
    Throws:
      `IOException` - if linkFile has an invalid relative link-path that failed to normalize

  - ### getLinkStatus

    default LinkHandler.LinkStatus getLinkStatus(Consumer<String> errorConsumer)
    Determine the link status. If a status is `LinkHandler.LinkStatus.BROKEN` and an `errorConsumer` has been specified the error details will be reported.
    Parameters:
      `errorConsumer` - broken link error consumer (may be null)
    Returns:
      link status