Skip to content

volk_prefs: add XDG Base Directory support#11

Open
mtibbits wants to merge 3 commits into
mainfrom
fix/792-xdg-config-path
Open

volk_prefs: add XDG Base Directory support#11
mtibbits wants to merge 3 commits into
mainfrom
fix/792-xdg-config-path

Conversation

@mtibbits
Copy link
Copy Markdown
Owner

@mtibbits mtibbits commented Apr 4, 2026

Summary

Add XDG Base Directory support to volk_get_config_path() and
volk_profile. New profiles are written to $XDG_CONFIG_HOME/volk/
(defaulting to ~/.config/volk/), with ~/.volk/ demoted to a
read-only fallback. When volk_profile detects a legacy config, it
offers an interactive migration prompt (suppressed in non-interactive
contexts).

GNU Radio already migrated to XDG (gnuradio/gnuradio#7136); this
aligns VOLK so both configs live in the same tree.

CONFIG vs CACHE

@jdemel noted that volk_config resembles FFTW wisdom
(regenerable, machine-specific profiling data), raising the question of
whether $XDG_CACHE_HOME would be more appropriate.

This PR uses $XDG_CONFIG_HOME because:

  1. The issue specifically requests a config path change
  2. GNU Radio's migration used $XDG_CONFIG_HOME
  3. Users expect volk_config alongside GNU Radio's config
  4. Cache data can be deleted without consequence; losing volk_config
    forces a full re-profile (~minutes), worse UX than typical cache loss

Happy to switch to $XDG_CACHE_HOME if the maintainers prefer —
the implementation is structurally identical.

Fallback chain

1. $VOLK_CONFIGPATH/volk/volk_config      (env override, unchanged)
2. $XDG_CONFIG_HOME/volk/volk_config      (NEW)
3. $HOME/.config/volk/volk_config         (NEW)
4. $HOME/.volk/volk_config                (legacy, read-only fallback)
5. $APPDATA/.volk/volk_config             (Windows, unchanged)
6. /etc/volk/volk_config                  (system-wide, unchanged)

Related issues

Fixes gnuradio#792

Testing

  • Fresh install (no config): volk_profile writes to ~/.config/volk/volk_config
  • Legacy config, accept migration: file moved, empty ~/.volk/ removed
  • Legacy config, decline migration: file stays, profile writes there too
  • Non-interactive (piped stdin): no prompt, keeps legacy path
  • -p /tmp/custom override: no prompt, writes to custom path
  • XDG_CONFIG_HOME=/tmp/xdg-test: writes to /tmp/xdg-test/volk/volk_config
  • XDG_CONFIG_HOME= (empty): treated as unset per XDG spec
  • Dual files exist: XDG path takes precedence on read
  • Move fails (permissions): warning printed, falls back to legacy

Checklist

  • Builds cleanly (cmake --build)
  • Tests pass (ctest)
  • Commits are signed off (git commit -s)
  • PR does one thing — no unrelated changes mixed in

@mtibbits mtibbits force-pushed the fix/792-xdg-config-path branch from bcc156e to 01e7660 Compare April 4, 2026 03:04
@mtibbits mtibbits force-pushed the fix/792-xdg-config-path branch from 01e7660 to db2b6dc Compare April 6, 2026 00:49
@mtibbits mtibbits force-pushed the fix/792-xdg-config-path branch 3 times, most recently from 057d2b8 to d2a45c7 Compare April 14, 2026 00:54
…ependency

Also bumps fmtlib to 12.1.0.

Signed-off-by: Sergi Granell Escalfet <xerpi.g.12@gmail.com>
jdemel and others added 2 commits April 26, 2026 12:04
cmake: Add `ENABLE_UTILITY_APPS` to avoid building volk_profile and avoid fmt dependency
Add XDG_CONFIG_HOME and $HOME/.config/volk lookup paths ahead of the
legacy $HOME/.volk location.  The legacy path becomes read-only so
that new volk_profile runs write to the XDG location.  Migration
prompt in volk_profile.cc detects the divergence and offers to move
the config.

Fixes: gnuradio#792

Signed-off-by: Matthew Tibbits <matt@tibbits.me>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Matthew Tibbits <894144+mtibbits@users.noreply.github.com>
@mtibbits mtibbits force-pushed the fix/792-xdg-config-path branch from d2a45c7 to a19a383 Compare April 27, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Linux config file folder location to follow XDG base directory specification

3 participants