fixes for several small "save as" bugs

This commit is contained in:
benfry
2004-10-10 01:30:42 +00:00
parent 616c7a62d6
commit 53fa60c6d9
2 changed files with 29 additions and 7 deletions

View File

@@ -585,7 +585,11 @@ public class PdeSketch {
"Save sketch folder as...",
FileDialog.SAVE);
// always default to the sketchbook folder..
fd.setDirectory(PdePreferences.get("sketchbook.path"));
//fd.setDirectory(PdePreferences.get("sketchbook.path"));
fd.setDirectory(folder.getParent());
fd.setFile(folder.getName());
//System.out.println("setting to " + folder.getParent());
// TODO or maybe this should default to the
// parent dir of the old folder?
@@ -608,6 +612,22 @@ public class PdeSketch {
return false;
}
// check to see if the user is trying to save this sketch
// inside the same sketch
try {
String newPath = newFolder.getCanonicalPath() + File.separator;
String oldPath = folder.getCanonicalPath() + File.separator;
//System.out.println(newPath);
//System.out.println(oldPath);
if (newPath.indexOf(oldPath) == 0) {
PdeBase.showWarning("How very Borges of you",
"You cannot save the sketch into a folder\n" +
"inside itself. This would go on forever.", null);
return false;
}
} catch (IOException e) { }
// copy the entire contents of the sketch folder
PdeBase.copyDir(folder, newFolder);
@@ -651,6 +671,9 @@ public class PdeSketch {
//sketchbook.rebuildMenu();
// done inside PdeEditor instead
// update the tabs for the name change
editor.header.repaint();
// let PdeEditor know that the save was successful
return true;
}

View File

@@ -23,12 +23,11 @@ X not really separate files, so that could be trouble.
X add file of a .pde or .java file should update the tabs bar
X and prolly not really complain if it's in the same folder
X dim "rename" when the main tab is selected (since user needs to "save as")
saving issues
_ "save as" not properly updating the tab header
_ also include the name of the previous sketch for "save as"
_ prevent folks from saving a sketch inside its own folder
_ will cause bizarro recursive folder action
X "save ass" issues
X "save as" not properly updating the tab header
X also include the name of the previous sketch for "save as"
X prevent folks from saving a sketch inside its own folder
X will cause bizarro recursive folder action
_ allow to use doubles on casting -- particularly for Math.cos() et al