Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix coojas path configuration when used without contiki #13

Merged
merged 1 commit into from
Apr 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions config/external_tools.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PATH_CONTIKI = ../../..
PATH_COOJA = ../
PATH_CONTIKI = ../../
PATH_COOJA_CORE_RELATIVE = /platform/cooja
PATH_MAKE = make
PATH_LINKER = ld
Expand All @@ -22,7 +23,7 @@ AR_COMMAND_2 =
CONTIKI_STANDARD_PROCESSES = sensors_process;etimer_process
CORECOMM_TEMPLATE_FILENAME = corecomm_template.java
PATH_JAVAC = javac
DEFAULT_PROJECTDIRS = [CONTIKI_DIR]/tools/cooja/apps/mrm;[CONTIKI_DIR]/tools/cooja/apps/mspsim;[CONTIKI_DIR]/tools/cooja/apps/avrora;[CONTIKI_DIR]/tools/cooja/apps/serial_socket;[CONTIKI_DIR]/tools/cooja/apps/powertracker
DEFAULT_PROJECTDIRS = [APPS_DIR]/mrm;[APPS_DIR]/mspsim;[APPS_DIR]/avrora;[APPS_DIR]/serial_socket;[APPS_DIR]/powertracker

PARSE_WITH_COMMAND=false
MAPFILE_DATA_START = ^.data[ \t]*0x([0-9A-Fa-f]*)[ \t]*0x[0-9A-Fa-f]*[ \t]*$
Expand Down
15 changes: 8 additions & 7 deletions java/org/contikios/cooja/Cooja.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ public String toString() {
public static Properties currentExternalToolsSettings;

private static final String externalToolsSettingNames[] = new String[] {
"PATH_CONTIKI", "PATH_COOJA_CORE_RELATIVE","PATH_COOJA","PATH_APPS",
"PATH_COOJA",
"PATH_CONTIKI", "PATH_COOJA_CORE_RELATIVE","PATH_APPS",
"PATH_APPSEARCH",

"PATH_MAKE",
Expand Down Expand Up @@ -4174,8 +4175,8 @@ public File restorePortablePath(File file) {

private final static String[][] PATH_IDENTIFIER = {
{"[CONTIKI_DIR]","PATH_CONTIKI",""},
{"[COOJA_DIR]","PATH_COOJA","/tools/cooja"},
{"[APPS_DIR]","PATH_APPS","/tools/cooja/apps"}
{"[COOJA_DIR]","PATH_COOJA",""},
{"[APPS_DIR]","PATH_APPS","apps"}
};

private File createContikiRelativePath(File file) {
Expand All @@ -4188,7 +4189,7 @@ private File createContikiRelativePath(File file) {
String fileCanonical = file.getCanonicalPath();

//No so nice, but goes along with GUI.getExternalToolsSetting
String defp = Cooja.getExternalToolsSetting("PATH_CONTIKI", null);
String defp = Cooja.getExternalToolsSetting("PATH_COOJA", null);


for(int i = 0; i < elem; i++){
Expand Down Expand Up @@ -4246,16 +4247,16 @@ private File restoreContikiRelativePath(File portable) {


if(i == elem) return null;
//logger.info("Found: " + PATH_IDENTIFIER[i][0]);
//logger.info("Found: " + PATH_IDENTIFIER[i][0]);

//No so nice, but goes along with GUI.getExternalToolsSetting
String defp = Cooja.getExternalToolsSetting("PATH_CONTIKI", null);
String defp = Cooja.getExternalToolsSetting("PATH_COOJA", null);
path = new File(Cooja.getExternalToolsSetting(PATH_IDENTIFIER[i][1], defp + PATH_IDENTIFIER[i][2]));

//logger.info("Config: " + PATH_IDENTIFIER[i][1] + ", " + defp + PATH_IDENTIFIER[i][2] + " = " + path.toString());
canonical = path.getCanonicalPath();

File absolute = new File(portablePath.replace(PATH_IDENTIFIER[i][0], canonical));
if(!absolute.exists()){
logger.warn("Replaced " + portable + " with " + absolute.toString() + " (default: "+ defp + PATH_IDENTIFIER[i][2] +"), but could not find it. This does not have to be an error, as the file might be created later.");
Expand Down