Skip to content

Commit 38f9389

Browse files
committed
* inst/private/__arduino_binary__.m: add binary lookup using ARDUINO_HOME
env var if available
1 parent d42d032 commit 38f9389

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

inst/private/__arduino_binary__.m

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
function arduino_binary = find_arduino_binary ()
3939

4040
# use arduino_debug.exe in windoze ?
41-
binary_name = "arduino";
41+
binary_name = {"arduino", "arduino-ide"};
4242
arduino_binary = "";
4343
have_prefs = false;
4444

@@ -52,11 +52,29 @@
5252
endif
5353

5454
if (isunix ())
55-
binaries = strcat (binary_name, {"", ".exe"});
55+
binaries = {}'
56+
for idx=1:numel(binary_name)
57+
binaries{end+1} = binary_name{idx};
58+
binaries{end+1} = strcat (binary_name{idx}, ".exe");
59+
endfor
5660
else
57-
binaries = strcat (binary_name, {".exe"});
61+
binaries = {}'
62+
for idx=1:numel(binary_name)
63+
binaries{end+1} = strcat (binary_name{idx}, ".exe");
64+
endfor
5865
endif
5966

67+
# do we have a ARDUINO_HOME ?
68+
if isempty (arduino_binary)
69+
if isenv("ARDUINO_HOME")
70+
n=0;
71+
while (n < numel (binaries) && isempty (arduino_binary))
72+
arduino_binary = file_in_path (getenv ("ARDUINO_HOME"), binaries{++n});
73+
endwhile
74+
endif
75+
endif
76+
77+
# can we find in path
6078
n = 0;
6179
while (n < numel (binaries) && isempty (arduino_binary))
6280
arduino_binary = file_in_path (getenv ("PATH"), binaries{++n});

0 commit comments

Comments
 (0)