Skip to content

Commit

Permalink
Windows compat
Browse files Browse the repository at this point in the history
  • Loading branch information
KKV9 authored and KKV9 committed Jul 7, 2024
1 parent ed63833 commit 858a803
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local function notify_error(message, urgency)
})
end

-- Make table of selected or hovered: path = "filenames"
-- Make table of selected or hovered: path = filenames
local selected_or_hovered = ya.sync(function()
local tab, paths, names, path_fnames = cx.active, {}, {}, {}
for _, u in pairs(tab.selected) do
Expand All @@ -30,7 +30,15 @@ end)

-- Check if archive command is available
local function is_command_available(cmd)
local stat_cmd = string.format("command -v %s >/dev/null 2>&1", cmd)
local is_windows = package.config:sub(1, 1) == "\\"
local stat_cmd

if is_windows then
stat_cmd = string.format("where %s > nul 2>&1", cmd)
else
stat_cmd = string.format("command -v %s >/dev/null 2>&1", cmd)
end

local cmd_exists = os.execute(stat_cmd)
if cmd_exists then
return true
Expand Down

0 comments on commit 858a803

Please sign in to comment.