Skip to content

Commit

Permalink
feat: use powershell to unzip on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
moetayuko committed Feb 13, 2024
1 parent 863213b commit a13c09e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lua/Trans/core/install.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ return function()
local continue = fn.filereadable(zip) == 1
local handle = function(output)
if output.exit == 0 and fn.filereadable(zip) then
if fn.executable 'unzip' == 0 then
vim.notify('unzip not found, Please unzip ' .. zip .. 'manually', vim.log.ERROR)
return
end

local cmd = string.format('unzip %s -d %s', zip, dir)
local cmd =
Trans.system == 'win' and
string.format('powershell.exe -Command "Expand-Archive -Force %s %s"', zip, dir) or
fn.executable('unzip') == 1 and string.format('unzip %s -d %s', zip, dir) or
error('unzip not found, Please unzip ' .. zip .. ' manually')
local status = os.execute(cmd)
os.remove(zip)
if status == 0 then
Expand Down

0 comments on commit a13c09e

Please sign in to comment.