GP-1164: Reorganizing Ghidra's user settings/cache/temp directories to support XDG

This commit is contained in:
Ryan Kurtz
2023-12-19 08:22:40 -05:00
parent 8bfcb02166
commit 3c30ada14c
50 changed files with 919 additions and 222 deletions

View File

@@ -83,17 +83,47 @@ VMARGS_WINDOWS=-Dlog4j.skipJansi=true
# Ghidra does not use class data sharing, so explicitly turn it off to avoid the warning.
VMARGS=-Xshare:off
# Persistent cache directory used by the application. This directory will be used to store
# persistent application caches for all users. The default location for Mac/Linux is the same as
# specified by java.io.tmpdir property. The default location for Windows corresponds to the
# application local settings directory for the user (e.g., %LOCALAPPDATA%). If you wish to use a
# directory with more storage or avoid system cleanups, it may be desirable to override the default
# location.
# Settings directory used by the application to store application settings and data that persist
# between application sessions, system reboots, and periodic system cleanup. Overridden values
# are required to be absolute paths. The current user name may be incorporated into the settings
# directory's name if the settings directory lives outside of the user's home directory. The
# settings directory will be selected based on the following rules, in order of precedence:
# 1. System.getProperty("application.settingsdir")/[user-]<application>/<application>_<version>
# 2. System.getenv("XDG_CONFIG_HOME")/[user-]<application>/<application>_<version>
# 3. A platform specific default location:
# - Windows: %APPDATA%\<application>\<application>_<version>
# - Linux: $HOME/.config/<application>/<application>_<version>
# - macOS: $HOME/Library/<application>/<application>_<version>
#VMARGS=-Dapplication.settingsdir=
# Cache directory used by the application to store cached application data that ideally will persist
# between application sessions and system reboots, but is not required to do so. Files stored in
# the cache directory may be numerous and/or large. Overridden values are required to be absolute
# paths. The current user name may be incorporated into the cache directory's name if the cache
# directory lives outside of the user's home directory. The cache directory will be selected based
# on the following rules, in order of precedence
# 1. System.getProperty("application.cachedir")/[user-]<application>
# 2. System.getenv("XDG_CACHE_HOME")/[user-]<application>
# 3. A platform specific default location:
# - Windows: %LOCALAPPDATA%\<application>
# - Linux: /var/tmp/<user>-<application>
# - macOS: /var/tmp/<user>-<application>
#VMARGS=-Dapplication.cachedir=
# Temporary directory used by the application. This directory will be used for all temporary files
# and may also be used for the persistent user cache directory <java.io.tmpdir>/<username>-Ghidra.
# The specified directory must exist and have appropriate read/write/execute permissions
# Temporary directory used by the application to store short-lived files that are not required to
# persist between application sessions. Overridden values are required to be absolute paths. The
# current user name may be incorporated into the temporary directory's name if the temporary
# directory lives outside of the user's home directory. The temporary directory will be selected
# based on the following rules, in order of precedence:
# 1. System.getProperty("application.tempdir")/[user-]<application>
# 2. System.getenv("XDG_RUNTIME_DIR")/[user-]<application>
# 3. System.getProperty("java.io.tmpdir")/[user-]<application>
# Unless overridden below, the "java.io.tmpdir" system property typically defaults to the following
# platform specific locations:
# - Windows: %TEMP%
# - Linux: /tmp
# - macOS: $TMPDIR
#VMARGS=-Dapplication.tempdir=
#VMARGS=-Djava.io.tmpdir=
# Disable alternating row colors in tables

View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
#---------------------------------------------------------------------------------------------------
# Ghidra-Clean
# An interactive utility to discover and delete artifacts that Ghidra lays down on the filesystem.
#---------------------------------------------------------------------------------------------------
# Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
# the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
#MAXMEM=1G
VMARG_LIST="-Djava.awt.headless=true "
# Resolve symbolic link if present and get the directory this script lives in.
# NOTE: "readlink -f" is best but works on Linux only, "readlink" will only work if your PWD
# contains the link you are calling (which is the best we can do on macOS), and the "echo" is the
# fallback, which doesn't attempt to do anything with links.
SCRIPT_FILE="$(readlink -f "$0" 2>/dev/null || readlink "$0" 2>/dev/null || echo "$0")"
SCRIPT_DIR="${SCRIPT_FILE%/*}"
"${SCRIPT_DIR}"/launch.sh fg jre Ghidra-Clean "$MAXMEM" "$VMARG_LIST" utility.application.AppCleaner Ghidra

View File

@@ -0,0 +1,9 @@
:: Ghidra-Clean
:: An interactive utility to discover and delete artifacts that Ghidra lays down on the filesystem.
@echo off
setlocal
set VMARG_LIST=-Djava.awt.headless=true
call "%~dp0launch.bat" fg jdk Ghidra-Clean "" "" utility.application.AppCleaner Ghidra

View File

@@ -21,6 +21,7 @@ Linux/support/buildGhidraJar||GHIDRA||||END|
Linux/support/buildNatives||GHIDRA||||END|
Linux/support/convertStorage||GHIDRA||||END|
Linux/support/gdbGADPServerRun||GHIDRA||||END|
Linux/support/ghidraClean||GHIDRA||||END|
Linux/support/ghidraDebug||GHIDRA||||END|
Linux/support/pythonRun||GHIDRA||||END|
Linux/support/sleigh||GHIDRA||||END|
@@ -40,6 +41,7 @@ Windows/support/createPdbXmlFiles.bat||GHIDRA||||END|
Windows/support/dbgengGADPServerRun.bat||GHIDRA||||END|
Windows/support/dbgmodelGADPServerRun.bat||GHIDRA||||END|
Windows/support/ghidra.ico||GHIDRA||||END|
Windows/support/ghidraClean.bat||GHIDRA||||END|
Windows/support/ghidraDebug.bat||GHIDRA||||END|
Windows/support/launch.bat||GHIDRA||||END|
Windows/support/pythonRun.bat||GHIDRA||||END|