Skip to content

Commit c9d4630

Browse files
committed
Fallback on system avrdude if Arduino avrdude isn't present (Linux).
1 parent a6a1aca commit c9d4630

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

app/src/processing/app/debug/AvrdudeUploader.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,17 @@ public boolean avrdude(Collection p1, Collection p2) throws RunnerException {
176176

177177
public boolean avrdude(Collection params) throws RunnerException {
178178
List commandDownloader = new ArrayList();
179-
commandDownloader.add("avrdude");
180-
181-
// Point avrdude at its config file since it's in a non-standard location.
182-
if (Base.isLinux()) {
183-
// ???: is it better to have Linux users install avrdude themselves, in
184-
// a way that it can find its own configuration file?
185-
commandDownloader.add("-C" + Base.getHardwarePath() + "/tools/avrdude.conf");
186-
} else {
179+
180+
if(Base.isLinux()) {
181+
if ((new File(Base.getHardwarePath() + "/tools/" + "avrdude")).exists()) {
182+
commandDownloader.add(Base.getHardwarePath() + "/tools/" + "avrdude");
183+
commandDownloader.add("-C" + Base.getHardwarePath() + "/tools/avrdude.conf");
184+
} else {
185+
commandDownloader.add("avrdude");
186+
}
187+
}
188+
else {
189+
commandDownloader.add(Base.getHardwarePath() + "/tools/avr/bin/" + "avrdude");
187190
commandDownloader.add("-C" + Base.getHardwarePath() + "/tools/avr/etc/avrdude.conf");
188191
}
189192

app/src/processing/app/debug/Uploader.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,6 @@ protected boolean executeUploadCommand(Collection commandDownloader)
114114
String[] commandArray = new String[commandDownloader.size()];
115115
commandDownloader.toArray(commandArray);
116116

117-
String avrBasePath;
118-
119-
if(Base.isLinux()) {
120-
avrBasePath = new String(Base.getHardwarePath() + "/tools/");
121-
}
122-
else {
123-
avrBasePath = new String(Base.getHardwarePath() + "/tools/avr/bin/");
124-
}
125-
126-
commandArray[0] = avrBasePath + commandArray[0];
127-
128117
if (verbose || Preferences.getBoolean("upload.verbose")) {
129118
for(int i = 0; i < commandArray.length; i++) {
130119
System.out.print(commandArray[i] + " ");

0 commit comments

Comments
 (0)