allow saving .csc with contiki-relative paths when the .csc file is in a subdirectory of the referenced
application
This commit is contained in:
parent
eb1a147d7d
commit
9cb2fd8465
1 changed files with 19 additions and 0 deletions
|
@ -1556,6 +1556,9 @@ public class GUI extends Observable {
|
|||
"MOTETYPES");
|
||||
if (moteTypeClassNames != null) {
|
||||
for (String moteTypeClassName : moteTypeClassNames) {
|
||||
if (moteTypeClassName.trim().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
Class<? extends MoteType> moteTypeClass = tryLoadClass(this,
|
||||
MoteType.class, moteTypeClassName);
|
||||
|
||||
|
@ -4260,6 +4263,22 @@ public class GUI extends Observable {
|
|||
id += "/..";
|
||||
}
|
||||
}
|
||||
if (!fileCanonical.startsWith(configCanonical)) {
|
||||
/* SPECIAL CASE: Allow two parent directories */
|
||||
File parent = new File(configCanonical).getParentFile();
|
||||
if (parent != null) {
|
||||
configCanonical = parent.getCanonicalPath();
|
||||
id += "/..";
|
||||
}
|
||||
}
|
||||
if (!fileCanonical.startsWith(configCanonical)) {
|
||||
/* SPECIAL CASE: Allow three parent directories */
|
||||
File parent = new File(configCanonical).getParentFile();
|
||||
if (parent != null) {
|
||||
configCanonical = parent.getCanonicalPath();
|
||||
id += "/..";
|
||||
}
|
||||
}
|
||||
if (!fileCanonical.startsWith(configCanonical)) {
|
||||
/* File is not in a config subdirectory */
|
||||
/*logger.info("File is not in a config subdirectory: " + file.getAbsolutePath());*/
|
||||
|
|
Loading…
Reference in a new issue