Skip to content

Conversation

uncenter
Copy link

@uncenter uncenter commented Feb 5, 2025

Closes #357. To resolve the "configDir" (now appropriately renamed to "cacheDir");

  1. $DENO_DIR is checked, and is the result if present.
  2. Then $XDG_CACHE_HOME is checked, if present the result becomes $XDG_CACHE_HOME/deno.
  3. Finally defaults to $HOME/.deno if the above two fail.

The path resolved from the above three steps is then joined with the deployctl subdirectory.

@CLAassistant
Copy link

CLAassistant commented Feb 5, 2025

CLA assistant check
All committers have signed the CLA.

@uncenter
Copy link
Author

uncenter commented Feb 5, 2025

I plan on also PR-ing to Deno core to support XDG lookup there, where it looks like https://github.com/denoland/deno_cache_dir is used - https://github.com/denoland/deno_cache_dir also provides a TypeScript library. I'll leave this open but maybe we should add @deno/cache-dir as a dependency and use that instead of this patch?

@uncenter uncenter marked this pull request as draft February 5, 2025 15:32
@uncenter
Copy link
Author

uncenter commented Feb 5, 2025

I prefer the solution in #359, but we would need to wait or update @deno/cache-dir dep later when the XDG PR I made for the library is merged.

denoDir ||
(xdgCacheDir ? join(xdgCacheDir, "deno") : join(homeDir, ".deno")),
"deployctl",
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn, this gets really ugly really easy, the cache-dir library approach seems a lot more appealing to me.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do the same thing in the cache library, with nicer formatting. I can extract some of that into a variable to make it more readable ig, but yeah I prefer the using the library.

@uncenter uncenter closed this Apr 8, 2025
@uncenter uncenter deleted the fix/config-paths branch April 8, 2025 22:33
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.

deployctl saves its data to ~/.deno despite $XDG_CACHE_HOME was set

3 participants