Fix #2: modernize JACK config search (XDG support)#16
Fix #2: modernize JACK config search (XDG support)#16struktured wants to merge 2 commits intomasterfrom
Conversation
The JACK frontend's read_config() used C-style string manipulation and only checked ~/.projectM/config.inp before falling back to the install default. It didn't honor XDG_CONFIG_HOME and didn't gracefully handle missing default config. Replace with the Qt-based search pattern used in PR #14 for PipeWire: 1. ~/.projectM/config.inp 2. $XDG_CONFIG_HOME/projectM/config.inp (defaults to ~/.config) 3. Copy default into XDG location 4. Fall back to install default 5. Empty string -> built-in defaults (no abort) Also remove unused RESOURCE_PREFIX compile define. Closes #2 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Modernizes the JACK frontend’s config discovery to be XDG-aware and aligned with the PipeWire backend’s Qt-based implementation, avoiding legacy C-string handling and abort() paths.
Changes:
- Replaced
read_config()in the JACK frontend with a Qt-based search order including~/.projectMand$XDG_CONFIG_HOME+ fallback copy behavior. - Removed the unused
RESOURCE_PREFIXcompile definition from the JACK target.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/ui-jack/qprojectM-jack.cpp |
Reimplements read_config() with XDG support and safer fallbacks (Qt filesystem APIs). |
src/ui-jack/CMakeLists.txt |
Drops now-unused RESOURCE_PREFIX define after config path logic change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #define CONFIG_FILE "/share/projectM/config.inp" | ||
|
|
There was a problem hiding this comment.
CONFIG_FILE is already defined in qprojectm_mainwindow.hpp (included above). Redefining it here is redundant and can trigger macro-redefinition warnings (and potentially fail builds that treat warnings as errors). Prefer removing this #define and using the header’s definition, or replace both with a single shared constant in a common header.
| #define CONFIG_FILE "/share/projectM/config.inp" |
CONFIG_FILE is already defined in qprojectm_mainwindow.hpp which is included transitively. Defining it again triggers a redefinition warning that fails -Werror builds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@copilot review |
Closes #2
Summary
The JACK frontend's
read_config()was the oldest of the three backends — C-string manipulation, only checked~/.projectM/config.inp, no XDG support, and calledabort()on common failure paths.This replaces it with the same Qt-based search used in PipeWire (added in PR #14):
~/.projectM/config.inp\$XDG_CONFIG_HOME/projectM/config.inp(defaults to~/.configper XDG spec)Changes
src/ui-jack/qprojectM-jack.cpp— replaceread_config()(-79 lines, +44 lines)src/ui-jack/CMakeLists.txt— remove unusedRESOURCE_PREFIXdefineNotes on the original issue
The 2021 issue mentions
PROJECTM_DATADIR_PATH, which was a libprojectM 2.x build-time variable. In 4.x, preset paths come entirely fromPreset Path = ...inconfig.inp. Honoring XDG means users can override the default config location via\$XDG_CONFIG_HOME, which is the modern equivalent.Test plan
-DENABLE_JACK=ON~/.projectM/config.inpstill takes precedence if presentprojectM-jackwith config in~/.projectM/, with config in$XDG_CONFIG_HOME/projectM/, and with no user config)