don't allow "add files to sketch" to overwrite old files

This commit is contained in:
benfry
2004-06-21 16:49:08 +00:00
parent 4fbfd25b34
commit fdec20a13e
2 changed files with 15 additions and 12 deletions

View File

@@ -424,6 +424,16 @@ public class PdeSketch {
if (!dataFolder.exists()) dataFolder.mkdirs();
destFile = new File(dataFolder, filename);
}
// make sure they aren't the same file
if (sourceFile.equals(destFile)) {
PdeBase.showWarning("You can't fool me",
"This file has already been copied to the\n" +
"location where you're trying to add it.\n" +
"I ain't not doin nuthin'.", null);
return;
}
try {
PdeBase.copyFile(sourceFile, destFile);
} catch (IOException e) {
@@ -1263,14 +1273,6 @@ public class PdeSketch {
}
/**
* Returns the path to the sketch folder.
* Used by PdeEditor.handleSaveAs()
*/
//public String getPath() {
//return sketchFolder.getPath();
//}
/**
* Returns path to the main .pde file for this sketch.
*/