bug fix: no nm arguments (tested on linux)

This commit is contained in:
fros4943 2006-11-06 22:21:57 +00:00
parent 76055eba40
commit 3d551593ad

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ContikiMoteType.java,v 1.4 2006/11/06 18:01:56 fros4943 Exp $
* $Id: ContikiMoteType.java,v 1.5 2006/11/06 22:21:57 fros4943 Exp $
*/
package se.sics.cooja.contikimote;
@ -582,12 +582,21 @@ public class ContikiMoteType implements MoteType {
if (nmPath == null || nmPath.equals(""))
return null;
String[] splittedNmArgs = nmArgs.split(" ");
String[] nmExecArray = new String[1 + splittedNmArgs.length + 1];
String[] nmExecArray;
if (!nmArgs.trim().equals("")) {
// Arguments need to be passed to program
String[] splittedNmArgs = nmArgs.split(" ");
nmExecArray = new String[1 + splittedNmArgs.length + 1];
nmExecArray[0] = nmPath.trim();
nmExecArray[nmExecArray.length-1] = libraryFile.getAbsolutePath();
System.arraycopy(splittedNmArgs, 0, nmExecArray, 1, splittedNmArgs.length);
nmExecArray[0] = nmPath.trim();
nmExecArray[nmExecArray.length-1] = libraryFile.getAbsolutePath();
System.arraycopy(splittedNmArgs, 0, nmExecArray, 1, splittedNmArgs.length);
} else {
nmExecArray = new String[2];
nmExecArray[0] = nmPath.trim();
nmExecArray[1] = libraryFile.getAbsolutePath();
}
String line;
Process p = Runtime.getRuntime().exec(nmExecArray);
@ -607,6 +616,7 @@ public class ContikiMoteType implements MoteType {
if (nmData == null || nmData.size() == 0)
return null;
logger.debug("#4");
return nmData;
}