From 692441e1d58d87faa4a1b36007a1c659355ebc91 Mon Sep 17 00:00:00 2001 From: Bill Ferguson Date: Sat, 10 Mar 2018 12:52:22 -0500 Subject: [PATCH 1/5] Added wine awareness for unix, linux, and macos. Added open -a -W to the macos path so that the path returned by the finder will work correctly. --- lib/dtutils/file.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/dtutils/file.lua b/lib/dtutils/file.lua index 696cdbc..018a74a 100644 --- a/lib/dtutils/file.lua +++ b/lib/dtutils/file.lua @@ -66,7 +66,17 @@ 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 == "linux" or + dt.configuration.running_os == "unix" or + dt.configuration.running_os == "macos") 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 +225,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 @@ -512,6 +523,7 @@ function dtutils_file.executable_path_widget(executables) value = path, is_directory = false, changed_callback = function(self) + dt.print_log("checking that " .. self.value .. " exists") if dtutils_file.check_if_bin_exists(self.value) then dtutils_file.set_executable_path_preference(executable, self.value) end From 841026661a1c90d63b5fe6939a423763c4693841 Mon Sep 17 00:00:00 2001 From: Bill Ferguson Date: Sat, 10 Mar 2018 12:56:18 -0500 Subject: [PATCH 2/5] Removed debugging statement --- lib/dtutils/file.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/dtutils/file.lua b/lib/dtutils/file.lua index 018a74a..5ffe634 100644 --- a/lib/dtutils/file.lua +++ b/lib/dtutils/file.lua @@ -523,7 +523,6 @@ function dtutils_file.executable_path_widget(executables) value = path, is_directory = false, changed_callback = function(self) - dt.print_log("checking that " .. self.value .. " exists") if dtutils_file.check_if_bin_exists(self.value) then dtutils_file.set_executable_path_preference(executable, self.value) end From 83c1a5789add2571da9db04e27303e44ff24ecaa Mon Sep 17 00:00:00 2001 From: Bill Ferguson Date: Sat, 10 Mar 2018 13:07:19 -0500 Subject: [PATCH 3/5] Changed wine check to operating system isn't windows --- lib/dtutils/file.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/dtutils/file.lua b/lib/dtutils/file.lua index 5ffe634..c321644 100644 --- a/lib/dtutils/file.lua +++ b/lib/dtutils/file.lua @@ -67,12 +67,7 @@ function dtutils_file.check_if_bin_exists(bin) if string.len(path) > 0 then if dtutils_file.check_if_file_exists(path) then path = "\"" .. path .. "\"" - if (string.match(path, ".exe$") or string.match(path, ".EXE%")) and - (dt.configuration.running_os == "linux" or - dt.configuration.running_os == "unix" or - dt.configuration.running_os == "macos") then - result = "wine " .. path - elseif dt.configuration.running_os == "macos" then + if (string.match(path, ".exe$") or string.match(path, ".EXE%")) and dt.configuration.running_os ~= "windows" then result = "open -a -W " .. path else result = path From b4ea97ce37a5a00ac633dd47af5405ebe7777746 Mon Sep 17 00:00:00 2001 From: Bill Ferguson Date: Sat, 10 Mar 2018 13:38:17 -0500 Subject: [PATCH 4/5] Fixed accidently wiped out check for macos --- lib/dtutils/file.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/dtutils/file.lua b/lib/dtutils/file.lua index c321644..9d5a805 100644 --- a/lib/dtutils/file.lua +++ b/lib/dtutils/file.lua @@ -67,7 +67,10 @@ function dtutils_file.check_if_bin_exists(bin) if string.len(path) > 0 then if dtutils_file.check_if_file_exists(path) then path = "\"" .. path .. "\"" - if (string.match(path, ".exe$") or string.match(path, ".EXE%")) and dt.configuration.running_os ~= "windows" then + if (string.match(path, ".exe$") or string.match(path, ".EXE%")) and + dt.configuration.running_os ~= "windows" or + result = "wine " .. path + elseif dt.configuration.running_os == "macos" then result = "open -a -W " .. path else result = path From 1c587d372633c1e5821314e6c571e83ed3c7e657 Mon Sep 17 00:00:00 2001 From: Bill Ferguson Date: Sat, 10 Mar 2018 13:45:04 -0500 Subject: [PATCH 5/5] Changed wine test to check for .exe"$ or .EXE"$ because of quoting string paths --- lib/dtutils/file.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/dtutils/file.lua b/lib/dtutils/file.lua index 9d5a805..698962f 100644 --- a/lib/dtutils/file.lua +++ b/lib/dtutils/file.lua @@ -67,8 +67,7 @@ function dtutils_file.check_if_bin_exists(bin) if string.len(path) > 0 then if dtutils_file.check_if_file_exists(path) then path = "\"" .. path .. "\"" - if (string.match(path, ".exe$") or string.match(path, ".EXE%")) and - dt.configuration.running_os ~= "windows" or + 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