1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

Fallback on system avrdude if Arduino avrdude isn't present (Linux).

This commit is contained in:
David A. Mellis
2011-09-07 20:00:06 +02:00
parent a6a1aca8a2
commit c9d4630d2b
2 changed files with 11 additions and 19 deletions

View File

@ -176,14 +176,17 @@ public class AvrdudeUploader extends Uploader {
public boolean avrdude(Collection params) throws RunnerException {
List commandDownloader = new ArrayList();
commandDownloader.add("avrdude");
// Point avrdude at its config file since it's in a non-standard location.
if(Base.isLinux()) {
// ???: is it better to have Linux users install avrdude themselves, in
// a way that it can find its own configuration file?
if ((new File(Base.getHardwarePath() + "/tools/" + "avrdude")).exists()) {
commandDownloader.add(Base.getHardwarePath() + "/tools/" + "avrdude");
commandDownloader.add("-C" + Base.getHardwarePath() + "/tools/avrdude.conf");
} else {
commandDownloader.add("avrdude");
}
}
else {
commandDownloader.add(Base.getHardwarePath() + "/tools/avr/bin/" + "avrdude");
commandDownloader.add("-C" + Base.getHardwarePath() + "/tools/avr/etc/avrdude.conf");
}

View File

@ -114,17 +114,6 @@ public abstract class Uploader implements MessageConsumer {
String[] commandArray = new String[commandDownloader.size()];
commandDownloader.toArray(commandArray);
String avrBasePath;
if(Base.isLinux()) {
avrBasePath = new String(Base.getHardwarePath() + "/tools/");
}
else {
avrBasePath = new String(Base.getHardwarePath() + "/tools/avr/bin/");
}
commandArray[0] = avrBasePath + commandArray[0];
if (verbose || Preferences.getBoolean("upload.verbose")) {
for(int i = 0; i < commandArray.length; i++) {
System.out.print(commandArray[i] + " ");