minor bugfixes: support relative paths when saving simulation configs + check that simulation load succeeded

This commit is contained in:
fros4943 2009-03-22 14:05:19 +00:00
parent 65d64d0c06
commit f0c562a2c6

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: ScriptRunner.java,v 1.15 2009/03/03 15:24:18 fros4943 Exp $ * $Id: ScriptRunner.java,v 1.16 2009/03/22 14:05:19 fros4943 Exp $
*/ */
package se.sics.cooja.plugins; package se.sics.cooja.plugins;
@ -323,9 +323,10 @@ public class ScriptRunner implements Plugin {
logTextArea.setText(""); logTextArea.setText("");
gui.doLoadConfig(false, true, proposedDir); gui.doLoadConfig(false, true, proposedDir);
Vector<File> history = gui.getFileHistory(); if (gui.getSimulation() == null) {
return;
File cscFile = history.firstElement(); }
File cscFile = gui.currentConfigFile;
String testName = cscFile.getName().substring(0, cscFile.getName().length()-4); String testName = cscFile.getName().substring(0, cscFile.getName().length()-4);
File testDir = cscFile.getParentFile(); File testDir = cscFile.getParentFile();
File jsFile = new File(testDir, testName + ".js"); File jsFile = new File(testDir, testName + ".js");
@ -458,6 +459,7 @@ public class ScriptRunner implements Plugin {
} }
/* Get current simulation configuration */ /* Get current simulation configuration */
simulation.getGUI().currentConfigFile = cscFile;
Element root = new Element("simconf"); Element root = new Element("simconf");
Element simulationElement = new Element("simulation"); Element simulationElement = new Element("simulation");
simulationElement.addContent(simulation.getConfigXML()); simulationElement.addContent(simulation.getConfigXML());
@ -613,7 +615,7 @@ public class ScriptRunner implements Plugin {
if (line == null) { if (line == null) {
line = ""; line = "";
} }
testOutput.addMessage("", MessageList.NORMAL); testOutput.addMessage(line, MessageList.NORMAL);
if (line.contains("TEST OK")) { if (line.contains("TEST OK")) {
testSucceeded = true; testSucceeded = true;
break; break;