Support XDG Base directory specification for Linux - #264
Conversation
|
I'm pretty sure this will still run into the issues I fixed here: arch1t3cht@b5a071b Also worth noting that this will break regardless due to this line in Dependency Control (https://github.com/TypesettingTools/DependencyControl/blob/9b8d615f18e295f4777ea606a7173465bdaf140d/modules/DependencyControl/Record.moon#L44). It needs to be changed in there as well |
You're right, I will fix it. |
Co-authored-by: witchymary <63314339+witchymary@users.noreply.github.com>
| throw agi::EnvironmentError("Could not get home directory. Make sure HOME is set."); | ||
| } | ||
|
|
||
| std::string xdg_dir(std::string_view token, agi::fs::path const& fallback) { |
There was a problem hiding this comment.
token is not the right name for the parameter... (env_name would be better)
| SetToken("?state", old_root); | ||
| } else { | ||
| SetToken("?user", xdg_config/"aegisub"); | ||
| SetToken("?local", xdg_cache/"aegisub"); |
There was a problem hiding this comment.
Calling a cache dir ?local is somewhat misleading, but I guess we have to keep it for compatibility. ?cache would be a better name though.
|
|
||
| std::string xdg_dir(std::string_view token, agi::fs::path const& fallback) { | ||
| const char *env = getenv(token.data()); | ||
| if (env) return env; |
There was a problem hiding this comment.
The environment variable must be ignored if it is empty or doesn't contain an absolute path
|
This PR causes a crash on startup when the XDG dirs don't exist. This part of the spec is relevent:
|
Support added in TypesettingTools/DependencyControl#36. |
This PR will fix Issue Aegisub#226. Adapted from aria2/aria2@8bc1d37.
The basic idea just is:
The original PR is here: wangqr#132