From c058ec2d6070458a0b7d3ef56041e985412ee565 Mon Sep 17 00:00:00 2001 From: Mike Beattie Date: Tue, 18 Sep 2012 23:46:17 +1200 Subject: altos{lib,ui,droid}: move OS specific code out of altoslib This is to allow the usage of AltosLog on Android - no swing, so we need to push the "home directory" code used to pick a default telemetry logging path - using the PreferencesBackend interface for now. Signed-off-by: Mike Beattie --- altoslib/AltosPreferences.java | 4 +--- altoslib/AltosPreferencesBackend.java | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'altoslib') diff --git a/altoslib/AltosPreferences.java b/altoslib/AltosPreferences.java index a82ea3f6..47196d6e 100644 --- a/altoslib/AltosPreferences.java +++ b/altoslib/AltosPreferences.java @@ -19,7 +19,6 @@ package org.altusmetrum.AltosLib; import java.io.*; import java.util.*; -import javax.swing.filechooser.FileSystemView; public class AltosPreferences { public static AltosPreferencesBackend backend = null; @@ -145,8 +144,7 @@ public class AltosPreferences { if (logdir_string != null) logdir = new File(logdir_string); else { - /* Use the file system view default directory */ - logdir = new File(FileSystemView.getFileSystemView().getDefaultDirectory(), logdirName); + logdir = new File(backend.homeDirectory(), logdirName); if (!logdir.exists()) logdir.mkdirs(); } diff --git a/altoslib/AltosPreferencesBackend.java b/altoslib/AltosPreferencesBackend.java index 3fc4b0aa..a1184c0b 100644 --- a/altoslib/AltosPreferencesBackend.java +++ b/altoslib/AltosPreferencesBackend.java @@ -17,6 +17,8 @@ package org.altusmetrum.AltosLib; +import java.io.File; + public interface AltosPreferencesBackend { public String getString(String key, String def); @@ -38,4 +40,6 @@ public interface AltosPreferencesBackend { public void remove(String key); public void flush(); + + public File homeDirectory(); } -- cgit v1.2.3