1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-07 01:54:26 +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()) { if (path.startsWith(untitledPath) && !sketch.isModified()) {
continue; continue;
} }
PreferencesData.set("last.sketch" + index + ".path", path); storeSketchLocation(editor, "" + index);
int[] placement = editor.getPlacement();
String location = PApplet.join(PApplet.str(placement), ",");
PreferencesData.set("last.sketch" + index + ".location", location);
index++; index++;
} }
PreferencesData.setInteger("last.sketch.count", 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) { protected void storeRecentSketches(Sketch sketch) {
if (sketch.isUntitled()) { if (sketch.isUntitled()) {
return; return;