summaryrefslogtreecommitdiff
path: root/altoslib/AltosPreferences.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-05-09 21:04:11 -0700
committerKeith Packard <keithp@keithp.com>2013-05-09 21:04:11 -0700
commit17eada6e586731defa9fd75316670c2b2b1601ee (patch)
tree275a3d23bcaeb497f7d59a6fe64d291abdc9bac6 /altoslib/AltosPreferences.java
parent271e8adbc9549c7b3b4d0ec14e4edb1a6ab715d1 (diff)
altoslib: Add non-persistent 'last logdir' preference
This is used to record the last directory for reading or writing log files so that the UI can pop back to the same place next time. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosPreferences.java')
-rw-r--r--altoslib/AltosPreferences.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/altoslib/AltosPreferences.java b/altoslib/AltosPreferences.java
index 392497ef..088ca3d7 100644
--- a/altoslib/AltosPreferences.java
+++ b/altoslib/AltosPreferences.java
@@ -62,6 +62,9 @@ public class AltosPreferences {
/* Log directory */
public static File logdir;
+ /* Last log directory - use this next time we open or save something */
+ public static File last_logdir;
+
/* Map directory -- hangs of logdir */
public static File mapdir;
@@ -198,6 +201,24 @@ public class AltosPreferences {
}
}
+ public static File last_logdir() {
+ synchronized (backend) {
+ if (last_logdir == null)
+ last_logdir = logdir;
+ return last_logdir;
+ }
+ }
+
+ public static void set_last_logdir(File file) {
+ synchronized(backend) {
+ if (file != null && !file.isDirectory())
+ file = file.getParentFile();
+ if (file == null)
+ file = new File(".");
+ last_logdir = file;
+ }
+ }
+
public static File mapdir() {
synchronized (backend) {
return mapdir;