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 = {
|
drag_and_drop = {
|
||||||
insert_mode = true,
|
insert_mode = true,
|
||||||
},
|
},
|
||||||
|
-- required for Windows users
|
||||||
|
use_absolute_path = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -61,13 +61,14 @@ M.get_base64_content = function(filepath)
|
|||||||
local output
|
local output
|
||||||
if os_mapping == "darwin" or os_mapping == "linux" then
|
if os_mapping == "darwin" or os_mapping == "linux" then
|
||||||
output = Utils.shell_run(("cat %s | base64 | tr -d '\n'"):format(filepath))
|
output = Utils.shell_run(("cat %s | base64 | tr -d '\n'"):format(filepath))
|
||||||
if output.code == 0 then
|
|
||||||
return output.stdout
|
|
||||||
else
|
|
||||||
error("Failed to convert image to base64")
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
Utils.warn("Windows is not supported yet", { title = "Avante" })
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user