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

Cooja: update config file after save #740

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
15 changes: 7 additions & 8 deletions java/org/contikios/cooja/Cooja.java
Original file line number Diff line number Diff line change
Expand Up @@ -1674,12 +1674,6 @@ Simulation createSimulation(Element root, boolean quick, boolean rewriteCsc, Lon
* File to write
*/
void saveSimulationConfig(File file) {
this.currentConfigFile = file; /* Used to generate config relative paths */
try {
this.currentConfigFile = this.currentConfigFile.getCanonicalFile();
} catch (IOException e) {
}

try (var out = file.getName().endsWith(".gz")
? new GZIPOutputStream(new FileOutputStream(file)) : new FileOutputStream(file)) {
// Create and write to document
Expand All @@ -1693,9 +1687,14 @@ void saveSimulationConfig(File file) {
logger.info("Saved to file: " + file.getAbsolutePath());
} catch (Exception e) {
logger.warn("Exception while saving simulation config: " + e);
e.printStackTrace();
return;
}
}
try {
currentConfigFile = file.getCanonicalFile();
} catch (IOException e) {
currentConfigFile = file;
}
}

/** Returns a root element containing the simulation config. */
Element extractSimulationConfig() {
Expand Down