mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
Installation folder check both at startup and when user attempts to change
sketchbook location. Fixes #2719
This commit is contained in:
@ -754,10 +754,33 @@ public class BaseNoGui {
|
||||
initPortableFolder();
|
||||
|
||||
initParameters(args);
|
||||
|
||||
|
||||
checkInstallationFolder();
|
||||
|
||||
init(args);
|
||||
}
|
||||
|
||||
public static void checkInstallationFolder() {
|
||||
if (isIDEInstalledIntoSettingsFolder()) {
|
||||
showError(_("Incorrect IDE installation folder"), _("Your copy of the IDE is installed in a subfolder of your settings folder.\nPlease move the IDE to another folder."), 10);
|
||||
}
|
||||
if (isIDEInstalledIntoSketchbookFolder()) {
|
||||
showError(_("Incorrect IDE installation folder"), _("Your copy of the IDE is installed in a subfolder of your sketchbook.\nPlease move the IDE to another folder."), 10);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isIDEInstalledIntoSketchbookFolder() {
|
||||
return PreferencesData.has("sketchbook.path") && FileUtils.isSubDirectory(new File(PreferencesData.get("sketchbook.path")), new File(PreferencesData.get("runtime.ide.path")));
|
||||
}
|
||||
|
||||
public static boolean isIDEInstalledIntoSettingsFolder() {
|
||||
try {
|
||||
return FileUtils.isSubDirectory(BaseNoGui.getPlatform().getSettingsFolder(), new File(PreferencesData.get("runtime.ide.path")));
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static public void onBoardOrPortChange() {
|
||||
examplesFolder = getContentFile("examples");
|
||||
toolsFolder = getContentFile("tools");
|
||||
|
Reference in New Issue
Block a user