Skip to content

luxrays: rename GetConfigDir as GetCacheDir and use XDG_CACHE_HOME according to specifications #615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 18, 2025

Conversation

illwieckz
Copy link
Contributor

Rename GetConfigDir as GetCacheDir and use XDG_CACHE_HOME according to specifications.

  • ~/.config should only be used as a fallback if XDG_CONFIG_HOME isn't set.
  • ~/.config or XDG_CONFIG_HOME is a config directory, not a cache directory.
  • the cache directory is XDG_CACHE_HOME, is not set by default and should fallback on ~/.cache.
  • getenv returns nullptr but boost::filesystem::path doesn't accept nullptr.

This work is courtesy of I ♥ Compute initiative funded by 🇫🇷️ rebatir.fr.

…cording to specifications

- ~/.config should only be used as a fallback if XDG_CONFIG_HOME isn't set.
- ~/.config or XDG_CONFIG_HOME is a config directory, not a cache directory.
- the cache directory is XDG_CACHE_HOME, is not set by default and should fallback on ~/.cache.
- getenv returns nullptr but boost::filesystem::path doesn't accept nullptr.
@CodeFHD
Copy link
Member

CodeFHD commented May 14, 2025

I had a look after this was mentioned in #662

Looks OK to me.

  • Affects only Linux
  • Uses an environment variable only if defined
  • uses .cache instead of .config, which sounds resonable

No idea if there was an original reason not to use .cache, the commit history only mentions the use of /home/ vs /tmp/ to avoid automatic deletion of the caches.

If merged, I suggest to adapt the rest of the function for consistency, I.e. return kernelCacheDir instead of kernelConfigDir. The same instead of the variable name xdgCacheHome used by this PR, as the variable is not necessarily originating from XDG.

@howetuft
Copy link
Contributor

I'll take care of that soon, the destination should be version 2.11

@howetuft
Copy link
Contributor

Just a point of verification, since I see that this proposal is made on courtesy of a commercial company:

LuxCore is licensed under the Apache 2.0 license, so all contributions are made under this license. Before I merge, @illwieckz, can you please confirm that you explicitly agree with that?

@illwieckz
Copy link
Contributor Author

Just a point of verification, since I see that this proposal is made on courtesy of a commercial company:

LuxCore is licensed under the Apache 2.0 license, so all contributions are made under this license. Before I merge, @illwieckz, can you please confirm that you explicitly agree with that?

Yes, it is explicitly permitted to merge this contribution under the Apache 2.0 license.

@illwieckz
Copy link
Contributor Author

And just in case:

I explicitly permit to merge this contribution under any license.

@howetuft howetuft changed the base branch from master to for_v2.11 May 18, 2025 17:59
@howetuft howetuft merged commit 62c862d into LuxCoreRender:for_v2.11 May 18, 2025
@howetuft
Copy link
Contributor

OK, thank you! I made just a few adjustments as I switch from boost::filesystem to std::filesystem in v2.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.

3 participants