1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

Fixed wrong sketch structure check.

This commit is contained in:
Claudio Indellicati
2014-09-18 12:35:25 +02:00
committed by Cristian Maglie
parent 2702ccef0c
commit c2223107b1

View File

@ -2131,7 +2131,10 @@ public class Editor extends JFrame implements RunnerListener {
File file = SketchData.checkSketchFile(sketchFile);
if ((file == null) && !fileName.endsWith(".ino") && !fileName.endsWith(".pde")) {
if (file == null)
{
if (!fileName.endsWith(".ino") && !fileName.endsWith(".pde")) {
Base.showWarning(_("Bad file selected"),
_("Arduino can only open its own sketches\n" +
"and other files ending in .ino or .pde"), null);
@ -2159,7 +2162,7 @@ public class Editor extends JFrame implements RunnerListener {
if (result == JOptionPane.YES_OPTION) {
// create properly named folder
File properFolder = new File(file.getParent(), properParent);
File properFolder = new File(sketchFile.getParent(), properParent);
if (properFolder.exists()) {
Base.showWarning(_("Error"),
I18n.format(
@ -2177,7 +2180,7 @@ public class Editor extends JFrame implements RunnerListener {
return false;
}
// copy the sketch inside
File properPdeFile = new File(properFolder, file.getName());
File properPdeFile = new File(properFolder, sketchFile.getName());
try {
Base.copyFile(file, properPdeFile);
} catch (IOException e) {
@ -2186,7 +2189,7 @@ public class Editor extends JFrame implements RunnerListener {
}
// remove the original file, so user doesn't get confused
file.delete();
sketchFile.delete();
// update with the new path
file = properPdeFile;
@ -2195,6 +2198,7 @@ public class Editor extends JFrame implements RunnerListener {
return false;
}
}
}
try {
sketch = new Sketch(this, file);