JUCE
JUCE copied to clipboard
[Bug]: userApplicationDataDirectory resolved incorrectly on Linux
Detailed steps on how to reproduce the bug
userApplicationDataDirectory always resolve to the fallback.
getSpecialLocation(userApplicationDataDirectory) will always resolve to ~/.config.
What is the expected behaviour?
That is uses the env XDG_CONFIG_HOME, and if it is null or empty it uses the fallback.
From the spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
$XDG_CONFIG_HOME defines the base directory relative to which user-specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.
The gist of the problem is that File::getSpecialLocation() delegate the resolution to resolveXDGFolder(), which is incorrect. Instead it should do:
case userApplicationDataDirectory:
{
// XDG spec https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
const char* configDir = getenv ("XDG_CONFIG_HOME");
if (configDir && *configDir)
return File (CharPointer_UTF8 (configDir));
return File (CharPointer_UTF8 ("~/.config"));
}
Operating systems
Linux
What versions of the operating systems?
Any.
Architectures
x86_64
Stacktrace
No response
Plug-in formats (if applicable)
No response
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the develop branch
The bug is present on the develop branch
Code of Conduct
- [X] I agree to follow the Code of Conduct