Importing a subfolder of the sketchbook or importing a folder that contains the sketchbook is now blocked. Fixes #2795

This commit is contained in:
Federico Fissore 2015-06-04 16:39:27 +02:00
parent 5875909683
commit 3ecaf665ae
1 changed files with 10 additions and 1 deletions

View File

@ -2471,8 +2471,17 @@ public class Base {
}
}
// is there a valid library?
File libFolder = sourceFile;
if (FileUtils.isSubDirectory(new File(PreferencesData.get("sketchbook.path")), libFolder)) {
activeEditor.statusError(_("A subfolder of your sketchbook is not a valid library"));
return;
}
if (FileUtils.isSubDirectory(libFolder, new File(PreferencesData.get("sketchbook.path")))) {
activeEditor.statusError(_("You can't import a folder that contains your sketchbook"));
return;
}
String libName = libFolder.getName();
if (!BaseNoGui.isSanitaryName(libName)) {
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"