mcaselector icon indicating copy to clipboard operation
mcaselector copied to clipboard

Incorrect implementation of XDG Base Directory spec

Open nelind3 opened this issue 1 year ago • 0 comments

Describe the bug If you run mcaselector on a linux system that has flatpak installed the log files will end up in ~/.local/share/flatpak/exports/share/mcaselector (or equivalent if XDG_DATA_HOME is set). This happens because mcaselector incorretly writes to the first directory set in XDG_DATA_DIRS if XDG_DATA_HOME isn't set.

To Reproduce Steps to reproduce the behavior:

  1. Install flatpak on any linux distro that implements XDG Base Directory
  2. Set up mcaselector
  3. mcaselector log files will end up in the wrong place

Expected behavior If XDG_DATA_HOME isnt set mcaselector should fall back to ~/.local/share/mcaselector as that is the fallback specified in the spec (same goes for XDG_CONFIG_DIRS and its default ~/.config). As per the XDG Base Directory spec XDG_DATA_DIRS and XDG_CONFIG_DIRS should only be searched for pre-existing data and config files new files shouldnt be written to any of the set directories. See the 6th and 7th points in the bullet point list in the spec under Basics. This is why most distros will not set most of the XDG Base Directory env variables because they explicitly fall back to their respective default paths and not XDG_DATA_DIRS or XDG_CONFIG_DIRS. Additionally as of version 0.8 of the XDG Base Directory spec log files should be put in XDG_STATE_HOME (defaulting to ~/.local/state) instead of XDG_DATA_HOME. See the relevant section of the Environment Variables section of the spec

Environment (please complete the following information):

  • OS: Linux (Fedora linux in my case but any modern distribution will have the same issue)
  • Java version: 17.0.9
  • Version of MCA Selector: as far as i can see in #127 any version after 1.12.3 will exhibit this behaviour

nelind3 avatar Jan 07 '24 00:01 nelind3