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 TypeMethodDescriptionGet the stored link-path as a Ghidra URL or absolute normalized link-path from a link file.getFile()Returns the file that is associated with this link information..If this is a folder-link file get the corresponding linked folder.Get the stored link-path.default LinkHandler.LinkStatusgetLinkStatus(Consumer<String> errorConsumer) Determine the link status.default booleanDetermine if the link "directly" refers to an external resource (i.e., URL-basedlink path).default booleanReturns 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-basedlink path).NOTE: It is important to understand that if this method returns
falseit may link to another link that is external. If the a file external status is required anLinkHandler.LinkStatus.EXTERNALstatus should be checked usinggetLinkStatus(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 anexternal-linkwill 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 methodDomainFolder.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 (SeeLinkHandler.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 implementsLinkedDomainFilethe absolute path form must be used to avoid treating as relative to the incorrect parent folder. ALinkedDomainFilecan occur when the link-file exists within a linked-folder or subfolder.- Returns:
- associated link path
-
getAbsoluteLinkPath
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
Determine the link status. If a status isLinkHandler.LinkStatus.BROKENand anerrorConsumerhas been specified the error details will be reported.- Parameters:
errorConsumer- broken link error consumer (may be null)- Returns:
- link status
-