diff --git a/prism/CHANGELOG.txt b/prism/CHANGELOG.txt index be01da70..ed6b000c 100644 --- a/prism/CHANGELOG.txt +++ b/prism/CHANGELOG.txt @@ -1,5 +1,24 @@ This file contains details of the changes in each new version of PRISM. +----------------------------------------------------------------------------- +Changes since version 4.4 +----------------------------------------------------------------------------- + +* Default location of the XPRISM settings file has changed, + to avoid cluttering the user's home directory: + - On Linux (adhering to XDG Base Directory Specification): + $XDG_CONFIG_HOME/prism.settings (if that environment variable is set) + $HOME/.config/prism.settings (otherwise) + - On macOS: + $HOME/Library/Preferences/prism.settings + - On Windows: + .prism in the user's home directory (unchanged from previous location) + + If the settings file already exists in the legacy location + $HOME/.prism + XPRISM continues to use that location. + + ----------------------------------------------------------------------------- Version 4.4 (first released 23/7/2017) ----------------------------------------------------------------------------- diff --git a/prism/src/prism/Prism.java b/prism/src/prism/Prism.java index d05960c7..95688770 100644 --- a/prism/src/prism/Prism.java +++ b/prism/src/prism/Prism.java @@ -308,7 +308,7 @@ public class Prism extends PrismComponent implements PrismSettingsListener } /** - * Read in PRISM settings from the default file (.prism in user's home directory). + * Read in PRISM settings from the default file (see PrismSettings.getLocationForSettingsFile()). * If no file exists, attempt to create a new one with default settings. */ public void loadUserSettingsFile() @@ -318,7 +318,7 @@ public class Prism extends PrismComponent implements PrismSettingsListener /** * Read in PRISM settings from a specified file. - * If the file is null, use the default (.prism in user's home directory). + * If the file is null, use the default (see PrismSettings.getLocationForSettingsFile()). * If no file exists, attempt to create a new one with default settings. */ public void loadUserSettingsFile(File settingsFile) diff --git a/prism/src/prism/PrismSettings.java b/prism/src/prism/PrismSettings.java index 70fbeb8b..6dfb7f50 100644 --- a/prism/src/prism/PrismSettings.java +++ b/prism/src/prism/PrismSettings.java @@ -627,7 +627,27 @@ public class PrismSettings implements Observer listener.notifySettings(this); } } - + + /** + * Get the default location of the settings file. + *
+ * There is a legacy location (filename '.prism' in the user's + * home directory), and a modern location, which depends on the + * operating system: + * + *
+ * If the legacy settings file exists, this method returns that location. + * Otherwise, the modern location is returned. + *
+ * To support different settings files in derived tools (e.g. prism-games), + * the filename is derived from the tool name (see Prism.getToolName()). + */ public File getLocationForSettingsFile() { String toolName = Prism.getToolName().toLowerCase();