mirror of
https://github.com/processing/processing4.git
synced 2026-02-04 06:09:17 +01:00
fixes for several small "save as" bugs
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
11
todo.txt
11
todo.txt
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user