Skip to content
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

cache: Set default cache path based on $USER #11082

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

Sircular
Copy link
Contributor

Change the default cache directory to $TMPDIR/hugo_cache_$USER, so that multi-user systems do not have caches that interfere with each other. The other cache-choosing logic (e.g. Netlify exceptions, configuration options) are not affected.

Fixes #7391

Change the default cache directory to `$TMPDIR/hugo_cache_$USER`, so
that multi-user systems do not have caches that interfere with each
other.  The other cache-choosing logic (e.g. Netlify exceptions,
configuration options) are not affected.

Fixes gohugoio#7391
@CLAassistant
Copy link

CLAassistant commented Jun 10, 2023

CLA assistant check
All committers have signed the CLA.

@bep
Copy link
Member

bep commented Jun 12, 2023

Thanks for this.

I can merge this, but

  • You need to update the flag documentation in the code (
    cmd.Flags().StringP("cacheDir", "", "", "filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/")
    ) and not in the auto generated MD files.
  • Also, I think it's USERNAME on Windows? So maybe check if that's the case, and add a check for that if USER is not found.

@jmooring
Copy link
Member

On Windows 11, the cache directory is within the user's profile, and it's been that way since Windows 7 (and maybe earlier). For example:

C:\Users\joe\AppData\Local\Temp\hugo_cache

So if $USER doesn't exist, don't bother appending the user name.

@bep
Copy link
Member

bep commented Jun 12, 2023

OK, I'll merge -- the MD files will be overwritten anyhow.

@bep bep merged commit 258884f into gohugoio:master Jun 12, 2023
6 checks passed
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

user /tmp/hugo_$USER instead of /tmp/hugo_cache
4 participants