From a8c1418227669c989b51184aaaa9f86a9fdb7a36 Mon Sep 17 00:00:00 2001 From: Aarav <37036762+aaravrav@users.noreply.github.com> Date: Sat, 27 Jul 2024 23:38:40 +0530 Subject: [PATCH] feat: use the XDG Base Directory Specification for the cache folder Uses `XDG_CACHE_HOME/cmake-js` instead of `~/.cmake-js` --- lib/dist.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/dist.js b/lib/dist.js index 6bfbd320..a6681471 100644 --- a/lib/dist.js +++ b/lib/dist.js @@ -21,7 +21,15 @@ function testSum(sums, sum, fPath) { class Dist { get internalPath() { - const cacheDirectory = '.cmake-js' + const cacheDirectoryName = 'cmake-js' + const cacheDirectory = path.join( + process.env.XDG_CACHE_HOME ?? path.join( + os.homedir(), + '.cache' + ), + cacheDirectoryName + ) + const runtimeArchDirectory = this.targetOptions.runtime + '-' + this.targetOptions.arch const runtimeVersionDirectory = 'v' + this.targetOptions.runtimeVersion