Class ProjectLocator
-
Field Summary
Fields -
Constructor Summary
ConstructorsChangeModifierConstructorDescriptionProjectLocator(String path, String name) Construct a project locator object.protectedProjectLocator(String path, String name, URL url) -
Method Summary
ChangeModifier and TypeMethodDescriptionNEWvoidVerify that the specified project location directory exists in preparation for creating a new project.NEWvoidVerify that this project exists with its required marker file and data storage directory.booleanbooleanexists()Determine if the project exists.Get the absolute path of the directory which contains the project marker file (getMarkerFile()) and project directory (getProjectDir()) (i.e., parent directory).Get the project marker file associated with this project locator.getName()Returns the name of the project identified by this project info..Get the project storage directory associated with this project locator.static StringReturns the project directory file extension..static StringReturns the file extension suitable for creating file filters for the file chooser.Returns project lock file to prevent multiple accesses to the same project at once..getURL()Returns the URL associated with this local project..inthashCode()static booleanisProjectDir(File file) Returns whether the given file is a project directory..booleanReturns true if this project URL corresponds to a transient project (e.g., corresponds to remote Ghidra URL).NEWbooleanReturns true if this project location is only valid on a Windows platform..toString()
-
Field Details
-
PROJECT_FILE_SUFFIX
- See Also:
-
PROJECT_DIR_SUFFIX
- See Also:
-
-
Constructor Details
-
ProjectLocator
Construct a project locator object.- Parameters:
path- absolute path to parent directory (may or may not exist). The user's temp directory will be used if this value is null or blank. The use of "\" characters will always be replaced with "/". A path starting with either "//" or "\\" will be treated as a Windows UNC path. WARNING: Use of a relative paths should be avoided (e.g., on a windows platform an absolute path should start with a drive letter specification such as C:\path). A path such as "/path" on windows will utilize the current default drive and will not throw an exception. If a drive letter is specified it must specify an absolute path (e.g., C:\, C:\path).name- name of the project (may only contain alphanumeric characters or- Throws:
IllegalArgumentException- if an absolute path is not specified or invalid project name
-
ProjectLocator
- Throws:
IllegalArgumentException
-
-
Method Details
-
isTransient
public boolean isTransient()Returns true if this project URL corresponds to a transient project (e.g., corresponds to remote Ghidra URL).- Returns:
- true if this project URL corresponds to a transient project (e.g., corresponds to remote Ghidra URL)
-
getURL
Returns the URL associated with this local project.. If using a temporary transient project location this URL will refer to the remote server repository.- Returns:
- the URL associated with this local project.
-
getName
Returns the name of the project identified by this project info..- Returns:
- the name of the project identified by this project info.
-
getLocation
Get the absolute path of the directory which contains the project marker file (getMarkerFile()) and project directory (getProjectDir()) (i.e., parent directory).Directory path will always use '/' as a path separator and may have one of the following forms:
- Standard path: /a/b/
- Windows path: /C:/a/b
- Windows UNC path: //server/share/a/b
Note: directory may or may not exist.
- Returns:
- project location directory
-
isWindowsOnlyLocation NEW
public boolean isWindowsOnlyLocation()Returns true if this project location is only valid on a Windows platform..- Returns:
- true if this project location is only valid on a Windows platform.
-
getProjectDir
Get the project storage directory associated with this project locator.NOTE:
exists()orcheckProjectExistence()method should be used prior to the returned file.- Returns:
- the project directory
-
getMarkerFile
Get the project marker file associated with this project locator.NOTE:
exists()orcheckProjectExistence()method should be used prior to the returned file.- Returns:
- the marker file that indicates a Ghidra project.
-
getProjectLockFile
Returns project lock file to prevent multiple accesses to the same project at once..- Returns:
- project lock file to prevent multiple accesses to the same project at once.
-
getProjectDirExtension
Returns the project directory file extension..- Returns:
- the project directory file extension.
-
equals
-
hashCode
public int hashCode() -
toString
-
getProjectExtension
Returns the file extension suitable for creating file filters for the file chooser.- Returns:
- the file extension suitable for creating file filters for the file chooser
-
isProjectDir
Returns whether the given file is a project directory..- Parameters:
file- file to check- Returns:
- whether the given file is a project directory.
-
exists
public boolean exists()Determine if the project exists.IMPORTANT: This method or
checkProjectExistence()method should always be used prior to using File object returned bygetParentDir(),getMarkerFile()orgetProjectLockFile()since OS-specific checks are performed which may not be considered when using the returned File objects.- Returns:
- true if project storage exists.
-
checkProjectExistence NEW
Verify that this project exists with its required marker file and data storage directory.IMPORTANT: This method or
exists()method should always be used prior to using File object returned bygetParentDir(),getMarkerFile()orgetProjectLockFile()since OS-specific checks are performed which may not be considered when using the returned File objects.- Throws:
NotFoundException- if project does not exist
-
checkLocationExistence NEW
Verify that the specified project location directory exists in preparation for creating a new project.IMPORTANT: This method or
exists()method should always be used prior to using File object returned bygetParentDir(),getMarkerFile()orgetProjectLockFile()since OS-specific checks are performed which may not be considered when using the returned File objects.- Throws:
IOException- if project location does not exist
-