diff --git a/tools/cooja/examples/userplatform_debug/java/MoteDebugger.java b/tools/cooja/examples/userplatform_debug/java/MoteDebugger.java index 6fa7becaa..80f5dec48 100644 --- a/tools/cooja/examples/userplatform_debug/java/MoteDebugger.java +++ b/tools/cooja/examples/userplatform_debug/java/MoteDebugger.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: MoteDebugger.java,v 1.1 2006/08/21 12:13:14 fros4943 Exp $ + * $Id: MoteDebugger.java,v 1.2 2006/09/06 12:26:33 fros4943 Exp $ */ import java.awt.event.*; @@ -96,7 +96,7 @@ public class MoteDebugger extends VisPlugin {; logger.info("Extracted PID=" + pid); logger.info("Checking that source code file exists.."); - File sourceFile = new File("obj_cooja/" + moteToDebug.getType().getIdentifier() + ".c"); + File sourceFile = new File(ContikiMoteType.tempOutputDirectory, moteToDebug.getType().getIdentifier() + ".c"); if (!sourceFile.exists()) { logger.fatal("Can't find source file: " + sourceFile); return; @@ -114,7 +114,7 @@ public class MoteDebugger extends VisPlugin {; logger.info("Function name is: " + functionName); logger.info("Creating temporary file .tmp with initial commands"); - File tmpFile = new File("obj_cooja/" + ".tmp"); + File tmpFile = new File(ContikiMoteType.tempOutputDirectory, ".tmp"); if (tmpFile.exists()) { tmpFile.delete(); } @@ -142,7 +142,7 @@ public class MoteDebugger extends VisPlugin {; gdbProcess = Runtime.getRuntime().exec("xterm -e gdb" + " -nw -quiet " + " --pid=" + pid - + " -x " + "obj_cooja/" + tmpFile.getName() + + " -x " + ContikiMoteType.tempOutputDirectory.getName() + "/" + tmpFile.getName() ); logger.info("Sleeping 2500 ms while starting up GDB"); diff --git a/tools/cooja/java/se/sics/cooja/GUI.java b/tools/cooja/java/se/sics/cooja/GUI.java index ded640a2f..d41cd8044 100644 --- a/tools/cooja/java/se/sics/cooja/GUI.java +++ b/tools/cooja/java/se/sics/cooja/GUI.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: GUI.java,v 1.6 2006/09/06 10:23:24 fros4943 Exp $ + * $Id: GUI.java,v 1.7 2006/09/06 12:26:33 fros4943 Exp $ */ package se.sics.cooja; @@ -449,12 +449,12 @@ public class GUI extends JDesktopPane { File contikiBaseDir = new File(getExternalToolsSetting("PATH_CONTIKI")); File contikiCoreDir = new File(contikiBaseDir, getExternalToolsSetting("PATH_COOJA_CORE_RELATIVE")); - File libFile = new File(ContikiMoteType.tempOutputDirectory.getPath() - + File.separatorChar + moteTypeID + ContikiMoteType.librarySuffix); - File mapFile = new File(ContikiMoteType.tempOutputDirectory.getPath() - + File.separatorChar + moteTypeID + ContikiMoteType.mapSuffix); - File depFile = new File(ContikiMoteType.tempOutputDirectory.getPath() - + File.separatorChar + moteTypeID + ContikiMoteType.dependSuffix); + File libFile = new File(ContikiMoteType.tempOutputDirectory, + moteTypeID + ContikiMoteType.librarySuffix); + File mapFile = new File(ContikiMoteType.tempOutputDirectory, + moteTypeID + ContikiMoteType.mapSuffix); + File depFile = new File(ContikiMoteType.tempOutputDirectory, + moteTypeID + ContikiMoteType.dependSuffix); if (libFile.exists()) libFile.delete(); if (depFile.exists()) diff --git a/tools/cooja/java/se/sics/cooja/PlatformConfig.java b/tools/cooja/java/se/sics/cooja/PlatformConfig.java index 7ec6b990e..7417d2576 100644 --- a/tools/cooja/java/se/sics/cooja/PlatformConfig.java +++ b/tools/cooja/java/se/sics/cooja/PlatformConfig.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: PlatformConfig.java,v 1.2 2006/08/22 15:28:17 fros4943 Exp $ + * $Id: PlatformConfig.java,v 1.3 2006/09/06 12:26:33 fros4943 Exp $ */ package se.sics.cooja; @@ -134,8 +134,8 @@ public class PlatformConfig { */ public boolean appendUserPlatform(File userPlatform) throws FileNotFoundException, IOException { - File userPlatformConfig = new File(userPlatform.getPath() - + File.separatorChar + GUI.PLATFORM_CONFIG_FILENAME); + File userPlatformConfig = new File(userPlatform.getPath(), + GUI.PLATFORM_CONFIG_FILENAME); myUserPlatformHistory.add(userPlatform); return appendConfigFile(userPlatformConfig); } diff --git a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteType.java b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteType.java index fd72b4f5a..f9f80952b 100644 --- a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteType.java +++ b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteType.java @@ -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.2 2006/08/23 17:11:59 fros4943 Exp $ + * $Id: ContikiMoteType.java,v 1.3 2006/09/06 12:26:33 fros4943 Exp $ */ package se.sics.cooja.contikimote; @@ -86,7 +86,7 @@ public class ContikiMoteType implements MoteType { /** * Temporary output directory */ - final static public File tempOutputDirectory = new File("." + File.separatorChar + "obj_cooja" + File.separatorChar); + final static public File tempOutputDirectory = new File("obj_cooja"); // Regular expressions for parsing the map file final static private String bssSectionAddrRegExp = "^.bss[ \t]*0x([0-9A-Fa-f]*)[ \t]*0x[0-9A-Fa-f]*[ \t]*$"; @@ -182,10 +182,10 @@ public class ContikiMoteType implements MoteType { return false; } - File libFile = new File(ContikiMoteType.tempOutputDirectory.getPath() - + File.separatorChar + identifier + librarySuffix); - File mapFile = new File(ContikiMoteType.tempOutputDirectory.getPath() - + File.separatorChar + identifier + mapSuffix); + File libFile = new File(ContikiMoteType.tempOutputDirectory, + identifier + librarySuffix); + File mapFile = new File(ContikiMoteType.tempOutputDirectory, + identifier + mapSuffix); // Check that library file exists if (!libFile.exists()) { diff --git a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteTypeDialog.java b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteTypeDialog.java index 270b50baf..cd6be24f1 100644 --- a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteTypeDialog.java +++ b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteTypeDialog.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ContikiMoteTypeDialog.java,v 1.8 2006/09/06 10:32:31 fros4943 Exp $ + * $Id: ContikiMoteTypeDialog.java,v 1.9 2006/09/06 12:26:33 fros4943 Exp $ */ package se.sics.cooja.contikimote; @@ -158,8 +158,8 @@ public class ContikiMoteTypeDialog extends JDialog { // Check if library file with given identifier has already been loaded if (identifierOK && CoreComm.hasLibraryFileBeenLoaded(new File( - ContikiMoteType.tempOutputDirectory.getPath() - + File.separatorChar + testIdentifier + ContikiMoteType.tempOutputDirectory, + testIdentifier + ContikiMoteType.librarySuffix))) { identifierOK = false; } @@ -893,12 +893,12 @@ public class ContikiMoteTypeDialog extends JDialog { progressBar.setString("..compiling.."); final File contikiDir = new File(textContikiDir.getText()); final String identifier = textID.getText(); - File libFile = new File(ContikiMoteType.tempOutputDirectory.getPath() - + File.separatorChar + identifier + ContikiMoteType.librarySuffix); - File mapFile = new File(ContikiMoteType.tempOutputDirectory.getPath() - + File.separatorChar + identifier + ContikiMoteType.mapSuffix); - File depFile = new File(ContikiMoteType.tempOutputDirectory.getPath() - + File.separatorChar + identifier + ContikiMoteType.dependSuffix); + File libFile = new File(ContikiMoteType.tempOutputDirectory, + identifier + ContikiMoteType.librarySuffix); + File mapFile = new File(ContikiMoteType.tempOutputDirectory, + identifier + ContikiMoteType.mapSuffix); + File depFile = new File(ContikiMoteType.tempOutputDirectory, + identifier + ContikiMoteType.dependSuffix); if (libFile.exists()) { libFile.delete(); @@ -1163,12 +1163,12 @@ public class ContikiMoteTypeDialog extends JDialog { public static boolean compileLibrary(String identifier, File contikiDir, Vector sourceFiles, final MessageList appender) { - File libFile = new File(ContikiMoteType.tempOutputDirectory.getPath() - + File.separatorChar + identifier + ContikiMoteType.librarySuffix); - File mapFile = new File(ContikiMoteType.tempOutputDirectory.getPath() - + File.separatorChar + identifier + ContikiMoteType.mapSuffix); - File depFile = new File(ContikiMoteType.tempOutputDirectory.getPath() - + File.separatorChar + identifier + ContikiMoteType.dependSuffix); + File libFile = new File(ContikiMoteType.tempOutputDirectory, + identifier + ContikiMoteType.librarySuffix); + File mapFile = new File(ContikiMoteType.tempOutputDirectory, + identifier + ContikiMoteType.mapSuffix); + File depFile = new File(ContikiMoteType.tempOutputDirectory, + identifier + ContikiMoteType.dependSuffix); // Recheck that contiki path exists if (!contikiDir.exists()) { @@ -1251,7 +1251,7 @@ public class ContikiMoteTypeDialog extends JDialog { "LD_ARGS_2=" + GUI.getExternalToolsSetting("LINKER_ARGS_2", ""), "EXTRA_CC_ARGS=" + ccFlags, "CC=" + GUI.getExternalToolsSetting("PATH_C_COMPILER"), - "LD=" + GUI.getExternalToolsSetting("PATH_LINKER"), "COMPILE_MAIN=1", + "LD=" + GUI.getExternalToolsSetting("PATH_LINKER"), "PROJECTDIRS=" + sourceDirs, "PROJECT_SOURCEFILES=" + sourceFileNames, "PATH=" + System.getenv("PATH")}; @@ -1304,8 +1304,10 @@ public class ContikiMoteTypeDialog extends JDialog { err.close(); p.waitFor(); - if (p.exitValue() != 0) + if (p.exitValue() != 0) { + logger.fatal("Make file returned error: " + p.exitValue()); return false; + } } catch (Exception e) { logger.fatal("Error while compiling library: " + e); return false; @@ -1778,8 +1780,8 @@ public class ContikiMoteTypeDialog extends JDialog { // Check that all user platforms are valid for (File userPlatform : moteTypeUserPlatforms) { - File userPlatformConfig = new File(userPlatform.getPath() - + File.separatorChar + GUI.PLATFORM_CONFIG_FILENAME); + File userPlatformConfig = new File(userPlatform.getPath(), + GUI.PLATFORM_CONFIG_FILENAME); if (!userPlatformConfig.exists()) { textUserPlatforms.setBackground(Color.RED); textUserPlatforms.setToolTipText("Invalid user platform: " @@ -1866,7 +1868,7 @@ public class ContikiMoteTypeDialog extends JDialog { dispose(); } else if (e.getActionCommand().equals("clean")) { // Delete any created intermediate files - File objectDir = new File("obj_cooja"); + File objectDir = ContikiMoteType.tempOutputDirectory; if (objectDir.exists() && objectDir.isDirectory()) { File[] objectFiles = objectDir.listFiles(); for (File objectFile : objectFiles) diff --git a/tools/cooja/java/se/sics/cooja/dialogs/UserPlatformsDialog.java b/tools/cooja/java/se/sics/cooja/dialogs/UserPlatformsDialog.java index 8dd544472..9b711c3f9 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/UserPlatformsDialog.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/UserPlatformsDialog.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: UserPlatformsDialog.java,v 1.4 2006/08/23 14:29:44 fros4943 Exp $ + * $Id: UserPlatformsDialog.java,v 1.5 2006/09/06 12:26:33 fros4943 Exp $ */ package se.sics.cooja.dialogs; @@ -371,8 +371,8 @@ public class UserPlatformsDialog extends JDialog { return; } - File userPlatformConfigFile = new File(userPlatform.getPath() - + File.separatorChar + GUI.PLATFORM_CONFIG_FILENAME); + File userPlatformConfigFile = new File(userPlatform.getPath(), + GUI.PLATFORM_CONFIG_FILENAME); if (!userPlatformConfigFile.exists()) { logger.fatal("User platform has no configuration file: " + userPlatformConfigFile);