-
Notifications
You must be signed in to change notification settings - Fork 109
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
Use OS provided cache home to store cached files #182
Comments
We might also consider allowing the cache to be specified explicitly using an attribute such as |
The benefit of making this change is that cache directories don't get spread all over the place, which primarily comes into place when using Asciidoctor Diagram in a site generator. |
I generalised this issue to one where we use the OS provided user cache directory, not just the XDG stuff on Linux.
|
Exactly! |
Couple of implementation details that need to be figured out:
|
Since it's a well-defined location that's generally accepted as read/write, I think it's fine in this case. But if we want to be absolutely strict, then we'd have to require the use of unsafe mode. But seeing that no other program imposes that kind of requirement, I think that would be overkill.
I think we can continue doing that. We're really just talking about where the base directory is, so the cache doesn't get scattered across the filesystem. |
I recently (re)discovered the XDG basedir standard, which specifies a standard location for storing cache files for an application (particularly on Linux). I think Asciidoctor Diagram should follow this standard where possible.
The logic is pretty simple. The application directory should be created inside the directory specified by XDG_CACHE_HOME, which is typically
~/.cache
. In our case, the location would be$XDG_CACHE_HOME/asciidoctor/diagram
.In the event this environment variable is not specified, there are generally accepted fallbacks which can be found in the xdg-basedir npm package. See https://github.com/sindresorhus/xdg-basedir/blob/master/index.js
The text was updated successfully, but these errors were encountered: