Changeset 1018 in josm


Ignore:
Timestamp:
2008-10-05T12:50:00+02:00 (16 years ago)
Author:
stoecker
Message:

close bug #1628

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r938 r1018  
    3232 */
    3333public class Preferences {
    34 
     34   
     35    /**
     36    * Internal storage for the preferenced directory.
     37    * Do not access this variable directly!
     38    * @see #getPreferencesDirFile()
     39    */
     40    private File preferencesDirFile = null;
     41     
    3542        public static interface PreferenceChangedListener {
    3643                void preferenceChanged(String key, String newValue);
     
    8087        }
    8188
    82         public File getPreferencesDirFile() {
    83                 if (System.getenv("APPDATA") != null)
    84                         return new File(System.getenv("APPDATA"), "JOSM");
    85                 return new File(System.getProperty("user.home"), ".josm");
    86         }
    87        
     89    public File getPreferencesDirFile() {
     90        if (preferencesDirFile != null)
     91            return preferencesDirFile;
     92        String path;
     93        path = System.getProperty("josm.home");
     94        if (path != null) {
     95            preferencesDirFile = new File(path);
     96        } else {
     97            path = System.getenv("APPDATA");
     98            if (path != null) {
     99                preferencesDirFile = new File(path, "JOSM");
     100            } else {
     101                preferencesDirFile = new File(System.getProperty("user.home"), ".josm");
     102            }
     103        }
     104        return preferencesDirFile;
     105    }
     106   
    88107        public File getPluginsDirFile() {
    89108                return new File(getPreferencesDirFile(), "plugins");
Note: See TracChangeset for help on using the changeset viewer.