diff --git a/lib/dtutils/file.lua b/lib/dtutils/file.lua index 696cdbc..698962f 100644 --- a/lib/dtutils/file.lua +++ b/lib/dtutils/file.lua @@ -66,7 +66,14 @@ function dtutils_file.check_if_bin_exists(bin) if string.len(path) > 0 then if dtutils_file.check_if_file_exists(path) then - result = "\"" .. path .. "\"" + path = "\"" .. path .. "\"" + if (string.match(path, ".exe\"$") or string.match(path, ".EXE\"$")) and dt.configuration.running_os ~= "windows" then + result = "wine " .. path + elseif dt.configuration.running_os == "macos" then + result = "open -a -W " .. path + else + result = path + end end elseif dt.configuration.running_os == "linux" then local p = io.popen("which " .. bin) @@ -215,10 +222,11 @@ dtutils_file.libdoc.functions["check_if_file_exists"] = { } function dtutils_file.check_if_file_exists(filepath) + filepath = "\"" .. filepath .. "\"" local result if (dt.configuration.running_os == 'windows') then filepath = string.gsub(filepath, '[\\/]+', '\\') - result = os.execute('if exist "'..filepath..'" (cmd /c exit 0) else (cmd /c exit 1)') + result = os.execute('if exist '..filepath..' (cmd /c exit 0) else (cmd /c exit 1)') if not result then result = false end