bugfix: source file got lost when reloading msp motes

This commit is contained in:
fros4943 2008-10-29 16:36:33 +00:00
parent 0967158d86
commit fdcfbd0e62

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: MspMoteType.java,v 1.15 2008/10/05 15:49:10 fros4943 Exp $ * $Id: MspMoteType.java,v 1.16 2008/10/29 16:36:33 fros4943 Exp $
*/ */
package se.sics.cooja.mspmote; package se.sics.cooja.mspmote;
@ -237,16 +237,15 @@ public abstract class MspMoteType implements MoteType {
newException = (MoteTypeCreationException) newException.initCause(e); newException = (MoteTypeCreationException) newException.initCause(e);
newException.setCompilationOutput(compilationOutput); newException.setCompilationOutput(compilationOutput);
if (compilationOutput != null) { try { Thread.sleep(500); } catch (InterruptedException ignore) { }
try { Thread.sleep(500); } catch (InterruptedException ignore) { } ListModel tmp = compilationOutput.getModel();
ListModel tmp = compilationOutput.getModel(); for (int i=tmp.getSize()-5; i < tmp.getSize(); i++) {
for (int i=tmp.getSize()-5; i < tmp.getSize(); i++) { if (i < 0) {
if (i < 0) { continue;
continue;
}
logger.fatal(">> " + tmp.getElementAt(i));
} }
logger.fatal(">> " + tmp.getElementAt(i));
} }
logger.fatal("Compilation error: " + e.getMessage()); logger.fatal("Compilation error: " + e.getMessage());
throw newException; throw newException;
} }
@ -457,15 +456,15 @@ public abstract class MspMoteType implements MoteType {
final String command = getCompileCommand(filenameNoExtension); final String command = getCompileCommand(filenameNoExtension);
logger.info("-- Compiling MSP430 Firmware --"); logger.info("-- Compiling MSP430 Firmware --");
compileFirmware(command, filenameNoExtension + firmwareFileExtension, compileFirmware(command, sourceFile, filenameNoExtension + firmwareFileExtension,
parentDirectory, parentDirectory,
successAction, failAction, successAction, failAction,
compilationOutput, synchronous); compilationOutput, synchronous);
} }
protected void compileFirmware( protected void compileFirmware(
final String command, final String firmware, final String command, final File sourceFile,
final File parentDirectory, final String firmware, final File parentDirectory,
final Action successAction, final Action failAction, final Action successAction, final Action failAction,
final MessageList compilationOutput, boolean synchronous) throws Exception { final MessageList compilationOutput, boolean synchronous) throws Exception {
@ -659,7 +658,7 @@ public abstract class MspMoteType implements MoteType {
try { try {
File parentDir = new File(sourceTextField.getText()).getParentFile(); File parentDir = new File(sourceTextField.getText()).getParentFile();
compileFirmware( compileFirmware(
"make clean TARGET=" + target, null, "make clean TARGET=" + target, new File(sourceTextField.getText()), null,
parentDir, null, null, taskOutput, true); parentDir, null, null, taskOutput, true);
} catch (Exception e2) { } catch (Exception e2) {
} }