1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-17 06:52:18 +01:00

Don't rename read-only files in sketch on save (which becomes save-as).

http://code.google.com/p/arduino/issues/detail?id=639
This commit is contained in:
David A. Mellis 2011-09-16 12:45:24 -04:00
parent f77de7e8c0
commit 026794f1eb

View File

@ -707,21 +707,21 @@ public class Sketch {
"need to re-save this sketch to another location.");
// if the user cancels, give up on the save()
if (!saveAs()) return false;
}
// rename .pde files to .ino
File mainFile = new File(getMainFilePath());
File mainFolder = mainFile.getParentFile();
File[] pdeFiles = mainFolder.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".pde");
} else {
// rename .pde files to .ino
File mainFile = new File(getMainFilePath());
File mainFolder = mainFile.getParentFile();
File[] pdeFiles = mainFolder.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".pde");
}
});
if (pdeFiles != null && pdeFiles.length > 0) {
// Do rename of all .pde files to new .ino extension
for (File pdeFile : pdeFiles)
renameCodeToInoExtension(pdeFile);
}
});
if (pdeFiles != null && pdeFiles.length > 0) {
// Do rename of all .pde files to new .ino extension
for (File pdeFile : pdeFiles)
renameCodeToInoExtension(pdeFile);
}
for (int i = 0; i < codeCount; i++) {