1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-30 19:52:13 +01:00

Factored out method to save sketch location

This commit is contained in:
Cristian Maglie 2016-01-22 17:47:14 +01:00
parent c98c18089d
commit f5f478ced6

View File

@ -574,16 +574,19 @@ public class Base {
if (path.startsWith(untitledPath) && !sketch.isModified()) {
continue;
}
PreferencesData.set("last.sketch" + index + ".path", path);
int[] placement = editor.getPlacement();
String location = PApplet.join(PApplet.str(placement), ",");
PreferencesData.set("last.sketch" + index + ".location", location);
storeSketchLocation(editor, "" + index);
index++;
}
PreferencesData.setInteger("last.sketch.count", index);
}
private void storeSketchLocation(Editor editor, String index) {
String path = editor.getSketch().getMainFilePath();
String loc = StringUtils.join(editor.getPlacement(), ',');
PreferencesData.set("last.sketch" + index + ".path", path);
PreferencesData.set("last.sketch" + index + ".location", loc);
}
protected void storeRecentSketches(Sketch sketch) {
if (sketch.isUntitled()) {
return;