improv(trashCmd): use `jit.os` to detect OS

remotes/origin/HEAD
Chris Grieser 2024-10-26 14:48:55 +02:00
parent ed3c34d1e4
commit e04857f290
1 changed files with 8 additions and 5 deletions

View File

@ -4,11 +4,14 @@ local M = {}
---@return string|string[]
local function setDefaultTrashCmd()
local osTrashCmd
local system = vim.uv.os_uname().sysname:lower()
if system == "darwin" then osTrashCmd = "trash" end
if system:find("windows") then osTrashCmd = "trash" end
if system:find("linux") then osTrashCmd = { "gio", "trash" } end
assert(osTrashCmd, "Unknown operating system. Please provide a custom `trashCmd`.")
local system = jit.os:lower()
if system == "mac" or system == "osx" then
osTrashCmd = "trash"
elseif system == "windows" then
osTrashCmd = "trash"
else
osTrashCmd = { "gio", "trash" }
end
return osTrashCmd
end