Package generic.util

Class Path

java.lang.Object
generic.util.Path
All Implemented Interfaces:
Comparable<Path>

public class Path extends Object implements Comparable<Path>
A class to represent a PATH item.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Identifies an absolute directory path which has the following attributes: isEnabled = true isEditable = true isReadOnly = false
    Path(ResourceFile file, boolean isEnabled, boolean isEditable, boolean isReadOnly)
    Identifies an absolute directory path with the specified attributes.
    Path(File file)
    Identifies an absolute directory path which has the following attributes: isEnabled = true isEditable = true isReadOnly = false
    Path(String path)
    Identifies an absolute directory path which has the following attributes: isEnabled = true isEditable = true isReadOnly = false
    Path(String path, boolean enabled)
    Identifies an absolute directory path which has the following attributes: isEditable = true isReadOnly = false
    Path(String path, boolean isEnabled, boolean isEditable, boolean isReadOnly)
    Identifies an absolute directory path with the specified attributes.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    boolean
     
    boolean
     
    Parse the path string with path element placeholders, such as GHIDRA_HOME.
     
    Returns the path as a string with path element placeholders, such as GHIDRA_HOME.
    int
     
    boolean
    Returns true if this path can be modified.
    boolean
    Returns true if this path is enabled.
    boolean
    Returns true if the given path is a file inside of the current Ghidra application.
    boolean
    Returns true if this path is read-only, which indicates the path cannot be written.
    void
    setEnabled(boolean isEnabled)
     
    void
     
    void
     
    static String
    Returns the path as a string with path element placeholders, such as GHIDRA_HOME.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • Path

      public Path(File file)
      Identifies an absolute directory path which has the following attributes:
      • isEnabled = true
      • isEditable = true
      • isReadOnly = false
      Parameters:
      file - absolute directory path
    • Path

      public Path(ResourceFile file)
      Identifies an absolute directory path which has the following attributes:
      • isEnabled = true
      • isEditable = true
      • isReadOnly = false
      Parameters:
      file - absolute directory path
    • Path

      public Path(ResourceFile file, boolean isEnabled, boolean isEditable, boolean isReadOnly)
      Identifies an absolute directory path with the specified attributes.
      Parameters:
      file - absolute directory path
      isEnabled - directory path will be searched if true
      isEditable - if true files contained within directory are considered editable
      isReadOnly - if true files contained within directory are considered read-only
    • Path

      public Path(String path)
      Identifies an absolute directory path which has the following attributes:
      • isEnabled = true
      • isEditable = true
      • isReadOnly = false
      Parameters:
      path - absolute directory path
    • Path

      public Path(String path, boolean enabled)
      Identifies an absolute directory path which has the following attributes:
      • isEditable = true
      • isReadOnly = false
      Parameters:
      path - absolute directory path
      enabled - directory path will be searched if true
    • Path

      public Path(String path, boolean isEnabled, boolean isEditable, boolean isReadOnly)
      Identifies an absolute directory path with the specified attributes.
      Parameters:
      path - absolute directory path
      isEnabled - directory path will be searched if true
      isEditable - if true files contained within directory are considered editable
      isReadOnly - if true files contained within directory are considered read-only
  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isReadOnly

      public boolean isReadOnly()
      Returns true if this path is read-only, which indicates the path cannot be written.
      Returns:
      true if this path is read-only
    • isEditable

      public boolean isEditable()
      Returns true if this path can be modified.
      Returns:
      true if this path can be modified
    • isEnabled

      public boolean isEnabled()
      Returns true if this path is enabled. Enablement indicates the path should be used.
      Returns:
      true if this path is enabled
    • setEnabled

      public void setEnabled(boolean isEnabled)
    • getPath

      public ResourceFile getPath()
    • fromPathString

      public static ResourceFile fromPathString(String path)
      Parse the path string with path element placeholders, such as GHIDRA_HOME.
      Parameters:
      path - the path
      Returns:
      the path as a ResourceFile.
    • toPathString

      public static String toPathString(ResourceFile file)
      Returns the path as a string with path element placeholders, such as GHIDRA_HOME.
      Parameters:
      file - the file to translate
      Returns:
      the path as a string .
    • getPathAsString

      public String getPathAsString()
      Returns the path as a string with path element placeholders, such as GHIDRA_HOME.
      Returns:
      the path as a string .
    • isInstallationFile

      public boolean isInstallationFile()
      Returns true if the given path is a file inside of the current Ghidra application.
      Returns:
      true if the given path is a file inside of the current Ghidra application.
    • setPath

      public void setPath(String path)
    • setPath

      public void setPath(ResourceFile file)
    • exists

      public boolean exists()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(Path p)
      Specified by:
      compareTo in interface Comparable<Path>