aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-core/installer/managers/std.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2023-04-14 17:30:04 +0200
committerGitHub <noreply@github.com>2023-04-14 17:30:04 +0200
commit3664448c41717f1c40a42839cbb55c925ea11046 (patch)
tree819c188f62e270f24791542bbf9203ab95bae9d1 /lua/mason-core/installer/managers/std.lua
parentchore: autogenerate (#1209) (diff)
downloadmason-3664448c41717f1c40a42839cbb55c925ea11046.tar
mason-3664448c41717f1c40a42839cbb55c925ea11046.tar.gz
mason-3664448c41717f1c40a42839cbb55c925ea11046.tar.bz2
mason-3664448c41717f1c40a42839cbb55c925ea11046.tar.lz
mason-3664448c41717f1c40a42839cbb55c925ea11046.tar.xz
mason-3664448c41717f1c40a42839cbb55c925ea11046.tar.zst
mason-3664448c41717f1c40a42839cbb55c925ea11046.zip
fix(std): manually call zstd on Windows (#1212)
Closes #1207.
Diffstat (limited to 'lua/mason-core/installer/managers/std.lua')
-rw-r--r--lua/mason-core/installer/managers/std.lua21
1 files changed, 20 insertions, 1 deletions
diff --git a/lua/mason-core/installer/managers/std.lua b/lua/mason-core/installer/managers/std.lua
index 5bcca5ab..6112b317 100644
--- a/lua/mason-core/installer/managers/std.lua
+++ b/lua/mason-core/installer/managers/std.lua
@@ -193,13 +193,32 @@ local function untar_compressed(rel_path)
}
end
+---@async
+---@param rel_path string
+---@return Result
+---@nodiscard
+local function untar_zst(rel_path)
+ return platform.when {
+ unix = function()
+ return untar(rel_path)
+ end,
+ win = function()
+ local ctx = installer.context()
+ local uncompressed_tar = rel_path:gsub("%.zst$", "")
+ ctx.spawn.zstd { "-dfo", uncompressed_tar, rel_path }
+ ctx.fs:unlink(rel_path)
+ return untar(uncompressed_tar)
+ end,
+ }
+end
+
-- Order is important.
local unpack_by_filename = _.cond {
{ _.matches "%.tar$", untar },
{ _.matches "%.tar%.gz$", untar },
{ _.matches "%.tar%.bz2$", untar },
{ _.matches "%.tar%.xz$", untar_compressed },
- { _.matches "%.tar%.zst$", untar_compressed },
+ { _.matches "%.tar%.zst$", untar_zst },
{ _.matches "%.zip$", unzip },
{ _.matches "%.vsix$", unzip },
{ _.matches "%.gz$", gunzip },