support YAZI_FILE_CMD_PATH environment variable for file(1) path

This commit is contained in:
Nguyen Duc Toan 2024-02-28 21:14:58 +07:00
parent b6fb02fda3
commit 1338f9acbb

View file

@ -15,7 +15,8 @@ function M:preload()
urls[#urls + 1] = tostring(file.url) urls[#urls + 1] = tostring(file.url)
end end
local child, code = Command("file"):args({ "-bL", "--mime-type" }):args(urls):stdout(Command.PIPED):spawn() local file_cmd_path = os.getenv("YAZI_FILE_CMD_PATH") or "file"
local child, code = Command(file_cmd_path):args({ "-bL", "--mime-type" }):args(urls):stdout(Command.PIPED):spawn()
if not child then if not child then
ya.err("spawn `file` command returns " .. tostring(code)) ya.err("spawn `file` command returns " .. tostring(code))
return 0 return 0