From 33c60507aa1ac3c24415decc754a275faf7441ec Mon Sep 17 00:00:00 2001 From: David Cuartielles Date: Mon, 5 Sep 2005 21:29:26 +0000 Subject: [PATCH] DojoDave - 20050905 Changes to make the windows version 0001 pre-alpha work --- app/Compiler.java | 13 ++++++++++--- app/Downloader.java | 35 +++++++++++++++++++++++++---------- app/Editor.java | 4 +++- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/app/Compiler.java b/app/Compiler.java index 6324112b8..4cafd107b 100644 --- a/app/Compiler.java +++ b/app/Compiler.java @@ -72,9 +72,16 @@ public class Compiler implements MessageConsumer { System.out.println("Compiling Arduino program"); Process process; - String commandLine = userdir + "tools/gnumake -C " + userdir + "lib compile"; - //TODO test this in windows - if (Base.isWindows()) commandLine.replace('/','\\'); + String commandLine = ""; + //TODO test this in windows + // FIXME: this is really nasty, it seems that MACOS is making the + // compilation inside the lib folder, while windows is doing it + // inside the work folder ... why why why --DojoDave + if (Base.isWindows()) { + commandLine = userdir + "tools\\gnumake.exe -C " + userdir + ". compile"; + } else if (Base.isMacOS()) { + commandLine = userdir + "tools/gnumake -C " + userdir + "lib compile"; + } int result = 0; try { // System.out.println(commandLine); diff --git a/app/Downloader.java b/app/Downloader.java index 42e2b9dbc..e992933a1 100755 --- a/app/Downloader.java +++ b/app/Downloader.java @@ -75,9 +75,19 @@ public class Downloader implements MessageConsumer { System.out.println("Downloading - makefile"); Process process; int result = 0; + String command = ""; try { serial_port = Preferences.get("serial.port"); - String command = userdir + "lib/wiringlite/bin/gnumake SERIAL=" + serial_port + " -C " + userdir + "lib/wiringlite program"; + //TODO test this in windows + // FIXME: this is really nasty, it seems that MACOS is making the + // compilation inside the lib folder, while windows is doing it + // inside the work folder ... why why why --DojoDave + if (Base.isWindows()) { + command = userdir + "tools\\gnumake.exe SERIAL=" + serial_port + " -C " + userdir + ". program"; + } else if (Base.isMacOS()) { + command = userdir + "tools/gnumake SERIAL=" + serial_port + " -C " + "lib program"; + } +// String command = userdir + "lib/wiringlite/bin/gnumake SERIAL=" + serial_port + " -C " + userdir + "lib/wiringlite program"; System.out.println(command); process = Runtime.getRuntime().exec(command); new MessageSiphon(process.getInputStream(), this); @@ -108,7 +118,8 @@ public class Downloader implements MessageConsumer { String userdir = System.getProperty("user.dir") + File.separator; - return downloadNative(userdir); + //return downloadNative(userdir); + return downloadNew(userdir); } @@ -120,8 +131,15 @@ public class Downloader implements MessageConsumer { System.out.println("Downloading code"); - buildPath = userdir + "lib/tmp"; - + // FIXME: this is really nasty, it seems that MACOS is making the + // compilation inside the lib folder, while windows is doing it + // inside the work folder ... why why why --DojoDave + if (Base.isWindows()) { + buildPath = userdir + "tmp"; + } else if (Base.isMacOS()) { + buildPath = userdir + "lib/tmp"; + } + String commandDownloader[] = new String[] { userdir + "tools/avr/bin/uisp", //[2] Serial port @@ -215,9 +233,9 @@ public class Downloader implements MessageConsumer { boolean alreadyCompiled = true; // TODO must manage this flag from global prefs - boolean debug = true; + boolean debug = false; - String verbose = " "; + String verbose = " -s "; if (alreadyCompiled) { if (serial_port == "") { @@ -233,20 +251,17 @@ public class Downloader implements MessageConsumer { if (debug) System.out.println("userdir is "+userdir); int result = -1; - String ext = ""; // TODO make this code more portable using File.separator if (Base.isMacOS()) { - ext = ""; commandLine = userdir + "tools/avr/bin/uisp "; commandLine += " -dprog=stk500 -dspeed=9600 "; commandLine += " -dserial=" + serial_port; commandLine += " -dpart=ATmega8"; commandLine += " if=" +userdir + "lib/wiringlite/tmp/prog.hex --upload"; } else { - ext = ".exe"; - commandLine = userdir + "lib\\wiringlite\\bin\\gnumake" + ext + " SERIAL=" + serial_port + verbose + " -C " + userdir + "lib\\wiringlite program"; + commandLine = userdir + "tools\\gnumake.exe" + " SERIAL=" + serial_port + verbose + " -C " + userdir + ". program"; } if (debug) System.out.println(commandLine); diff --git a/app/Editor.java b/app/Editor.java index 529ce4d3c..cd6e95aea 100644 --- a/app/Editor.java +++ b/app/Editor.java @@ -1169,7 +1169,9 @@ public class Editor extends JFrame } catch (RunnerException e) { error(e); } - buttons.clear(); + // FIXED: 20050902 - DojoDave + // the clear button requires a the clearRun method instead of only clear!! + buttons.clearRun(); //- if (!sketch.handleRun()) return;