Querz / mcaselector

A tool to select chunks from Minecraft worlds for deletion or export.
MIT License
3.07k stars 171 forks source link

Incorrect implementation of XDG Base Directory spec #455

Open nelind3 opened 6 months ago

nelind3 commented 6 months ago

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):