improv(trashCmd): use `jit.os` to detect OS
parent
ed3c34d1e4
commit
e04857f290
|
|
@ -4,11 +4,14 @@ local M = {}
|
||||||
---@return string|string[]
|
---@return string|string[]
|
||||||
local function setDefaultTrashCmd()
|
local function setDefaultTrashCmd()
|
||||||
local osTrashCmd
|
local osTrashCmd
|
||||||
local system = vim.uv.os_uname().sysname:lower()
|
local system = jit.os:lower()
|
||||||
if system == "darwin" then osTrashCmd = "trash" end
|
if system == "mac" or system == "osx" then
|
||||||
if system:find("windows") then osTrashCmd = "trash" end
|
osTrashCmd = "trash"
|
||||||
if system:find("linux") then osTrashCmd = { "gio", "trash" } end
|
elseif system == "windows" then
|
||||||
assert(osTrashCmd, "Unknown operating system. Please provide a custom `trashCmd`.")
|
osTrashCmd = "trash"
|
||||||
|
else
|
||||||
|
osTrashCmd = { "gio", "trash" }
|
||||||
|
end
|
||||||
return osTrashCmd
|
return osTrashCmd
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue