-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathutils.lua
More file actions
23 lines (20 loc) · 556 Bytes
/
utils.lua
File metadata and controls
23 lines (20 loc) · 556 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
local U = {}
---Executes a child process
---@param cmd string
---@return unknown
function U.execute(cmd)
local handle = assert(io.popen(cmd), string.format('[Navigator] Unable to execute cmd - %q', cmd))
local result = handle:read("*a")
handle:close()
return result
end
---Returns executable suffix based on platform
---@return string
function U.suffix()
local uname = vim.loop.os_uname()
if string.find(uname.release, 'WSL.*$') or string.find(uname.sysname, '^Win') then
return '.exe'
end
return ''
end
return U