mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
fix: no empty file when image paste fail (closes #131)
This commit is contained in:
@@ -403,7 +403,9 @@ local function imgFromClipboard()
|
|||||||
local relpath = make_relative_path(vim.fn.expand("%:p"), png, "/")
|
local relpath = make_relative_path(vim.fn.expand("%:p"), png, "/")
|
||||||
|
|
||||||
local result = os.execute(get_paste_command(pngdir, pngname))
|
local result = os.execute(get_paste_command(pngdir, pngname))
|
||||||
if not result then
|
if not result or result > 0 then
|
||||||
|
-- Remove empty file created by previous command if failed
|
||||||
|
os.execute("rm " .. pngdir .. "/" .. pngname)
|
||||||
vim.api.nvim_err_writeln(
|
vim.api.nvim_err_writeln(
|
||||||
string.format(
|
string.format(
|
||||||
"Unable to write image %s. Is there an image on the clipboard? See also issue 131",
|
"Unable to write image %s. Is there an image on the clipboard? See also issue 131",
|
||||||
|
|||||||
Reference in New Issue
Block a user