Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 29 additions & 3 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,31 @@ public Base(String[] args) throws Exception {

// Create a new empty window (will be replaced with any files to be opened)
if (!opened) {
Messages.log("Calling handleNew() to open a new window");
handleNew();
} else {
System.out.println("Preferences file location: " + Base.getSettingsFile("preferences.txt").getAbsolutePath());
String lastPath = Preferences.get("last.sketch.path");
Messages.log("DEBUG: last.sketch.path = " + lastPath);

if (lastPath != null) {
File sketchFolder = new File(lastPath);
if (sketchFolder.exists()) {
Messages.log("Restoring last sketch at: " + lastPath);
File mainSketchFile = Sketch.findMain(sketchFolder, getModeList());
if (mainSketchFile != null) {
handleOpen(mainSketchFile.getAbsolutePath());
} else {
Messages.log("Could not find main sketch file in folder, falling back to new sketch");
handleNew();
}
} else {
Messages.log("Last sketch path not found, falling back to new sketch");
handleNew();
}
} else {
Messages.log("No saved sketch path, opening new sketch");
handleNew();
}

} else {
Messages.log("No handleNew(), something passed on the command line");
}

Expand Down Expand Up @@ -1456,6 +1478,10 @@ public Editor handleOpen(String path) {
}

File parentFolder = pdeFile.getParentFile();
Preferences.set("last.sketch.path", parentFolder.getAbsolutePath());
Preferences.save(); // force write to disk
System.out.println("Preferences file location: " + Base.getSettingsFile("preferences.txt").getAbsolutePath());
System.out.println("Saved last sketch path: " + parentFolder.getAbsolutePath());

try {
// read the sketch.properties file or get an empty Settings object
Expand Down
3 changes: 2 additions & 1 deletion core/methods/src/PAppletMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant
.BuildException;
import org.apache.tools.ant.Task;


Expand Down