feat(clipboard): support windows (#345)
Signed-off-by: Hanchin Hsieh <me@yuchanns.xyz>
This commit is contained in:
parent
38a5dbe429
commit
cb197fb606
@ -49,6 +49,8 @@ Install `avante.nvim` using [lazy.nvim](https://github.com/folke/lazy.nvim):
|
||||
drag_and_drop = {
|
||||
insert_mode = true,
|
||||
},
|
||||
-- required for Windows users
|
||||
use_absolute_path = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -61,14 +61,15 @@ M.get_base64_content = function(filepath)
|
||||
local output
|
||||
if os_mapping == "darwin" or os_mapping == "linux" then
|
||||
output = Utils.shell_run(("cat %s | base64 | tr -d '\n'"):format(filepath))
|
||||
else
|
||||
output =
|
||||
Utils.shell_run(("([Convert]::ToBase64String([IO.File]::ReadAllBytes('%s')) -replace '`r`n')"):format(filepath))
|
||||
end
|
||||
if output.code == 0 then
|
||||
return output.stdout
|
||||
else
|
||||
error("Failed to convert image to base64")
|
||||
end
|
||||
else
|
||||
Utils.warn("Windows is not supported yet", { title = "Avante" })
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
Loading…
x
Reference in New Issue
Block a user