From e04857f2905c07e70d366f30beb0e2765dbe9413 Mon Sep 17 00:00:00 2001 From: Chris Grieser <73286100+chrisgrieser@users.noreply.github.com> Date: Sat, 26 Oct 2024 14:48:55 +0200 Subject: [PATCH] improv(trashCmd): use `jit.os` to detect OS --- lua/genghis/config.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lua/genghis/config.lua b/lua/genghis/config.lua index 6163cf1..e25b325 100644 --- a/lua/genghis/config.lua +++ b/lua/genghis/config.lua @@ -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