Skip to content

Adhere to XDG Base Directory specification

Ignacy Kajdan requested to merge verahawk/kdesrc-build:xdg_spec into master

Summary

Makes kdesrc-build and kdesrc-build-setup compliant with XDG Base Directory specification. Largely based on suggestions mentioned in !11 (closed).

It would be wise to factor out the code related to config files in the future. Especially the part responsible for checking if $XDG_* variables are set. I am not sure where could it be placed, as I am not familiar with the codebase. Any suggestions are welcome.

Link to the specification: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html.

Old order of checking

  • Config: ./kdesrc-buildrc~/.kdesrc-buildrc
  • Cache: <config base directory>/.kdesrc-build-data

New order of checking

  • Config: ./kdesrc-buildrc~/.config/kdesrc-buildrc ($XDG_CONFIG_HOME/kdesrc-buildrc, if $XDG_CONFIG_HOME is set) → ~/.kdesrc-buildrc
  • Cache:
    • When global config is used: ~/.cache/kdesrc-build-data ($XDG_CACHE_HOME/kdesrc-build-data, if $XDG_CACHE_HOME is set)
    • When local config is used: <config base directory>/.kdesrc-build-data

Backward compatibility

If the configuration file is not found in the new location, kdesrc-build will check for ~/.kdesrc-buildrc. A warning message will be printed. kdesrc-build will create and use cache file in appropriate location.

Files won't be moved automatically to new locations.

Testing

Just checkout this MR and try to use kdesrc-build as usual. Afterwards move your ~/.kdesrc-buildrc and ~/.kdesrc-build-data to new locations and check if everything works as expected. Also, try to generate new config using kdesrc-build-setup and see, if it's saved in correct location.


BUG: 410921

Closes: #71 (closed)

Edited by Ignacy Kajdan

Merge request reports