diff options
author | 2022-10-19 16:19:50 -0700 | |
---|---|---|
committer | 2022-10-19 16:19:50 -0700 | |
commit | 605c4297700faa9c03bf29b55bee464c7706cbc8 (patch) | |
tree | 72ff755e3178ea8e77884b4bc01b2631ce735e87 /src | |
parent | b064872d9ae6ec779a588ea9157c6f0e22a99ee1 (diff) | |
download | bun-605c4297700faa9c03bf29b55bee464c7706cbc8.tar.gz bun-605c4297700faa9c03bf29b55bee464c7706cbc8.tar.zst bun-605c4297700faa9c03bf29b55bee464c7706cbc8.zip |
Cache dir loader: Prefer `$BUN_INSTALL` and `$XDG_CACHE_HOME` to `$HOME`. (#1351)
This partially addresses https://github.com/oven-sh/bun/issues/696 , by using `$XDG_CACHE_HOME` for those of us who already have that env var set.
Diffstat (limited to 'src')
-rw-r--r-- | src/install/install.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/install/install.zig b/src/install/install.zig index 60d8e2fdf..7ea14acf6 100644 --- a/src/install/install.zig +++ b/src/install/install.zig @@ -2482,11 +2482,6 @@ pub const PackageManager = struct { return CacheDir{ .path = dir, .is_node_modules = false }; } - if (env_loader.map.get("HOME")) |dir| { - var parts = [_]string{ dir, ".bun/", "install/", "cache/" }; - return CacheDir{ .path = Fs.FileSystem.instance.abs(&parts), .is_node_modules = false }; - } - if (env_loader.map.get("BUN_INSTALL")) |dir| { var parts = [_]string{ dir, "install/", "cache/" }; return CacheDir{ .path = Fs.FileSystem.instance.abs(&parts), .is_node_modules = false }; @@ -2497,6 +2492,11 @@ pub const PackageManager = struct { return CacheDir{ .path = Fs.FileSystem.instance.abs(&parts), .is_node_modules = false }; } + if (env_loader.map.get("HOME")) |dir| { + var parts = [_]string{ dir, ".bun/", "install/", "cache/" }; + return CacheDir{ .path = Fs.FileSystem.instance.abs(&parts), .is_node_modules = false }; + } + var fallback_parts = [_]string{"node_modules/.bun-cache"}; return CacheDir{ .is_node_modules = true, .path = Fs.FileSystem.instance.abs(&fallback_parts) }; } |