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
|
@ -1556,6 +1556,9 @@ public class GUI extends Observable {
|
||||||
"MOTETYPES");
|
"MOTETYPES");
|
||||||
if (moteTypeClassNames != null) {
|
if (moteTypeClassNames != null) {
|
||||||
for (String moteTypeClassName : moteTypeClassNames) {
|
for (String moteTypeClassName : moteTypeClassNames) {
|
||||||
|
if (moteTypeClassName.trim().isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Class<? extends MoteType> moteTypeClass = tryLoadClass(this,
|
Class<? extends MoteType> moteTypeClass = tryLoadClass(this,
|
||||||
MoteType.class, moteTypeClassName);
|
MoteType.class, moteTypeClassName);
|
||||||
|
|
||||||
|
@ -4260,6 +4263,22 @@ public class GUI extends Observable {
|
||||||
id += "/..";
|
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)) {
|
if (!fileCanonical.startsWith(configCanonical)) {
|
||||||
/* File is not in a config subdirectory */
|
/* File is not in a config subdirectory */
|
||||||
/*logger.info("File is not in a config subdirectory: " + file.getAbsolutePath());*/
|
/*logger.info("File is not in a config subdirectory: " + file.getAbsolutePath());*/
|
||||||
|
|
Loading…
Reference in a new issue