Ignore:
Timestamp:
2014-12-19T15:05:33+01:00 (8 years ago)
Author:
Don-vip
Message:

see #10026 - use recommended user data directory on OSX (distinct from preferences directory). Linux and Windows behaviour is unchanged.

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r7805 r7834  
    880880            }
    881881        }
    882         // Try user-preference directory
    883         String dir = Main.pref.getPreferencesDir() + "images";
     882        // Try user-data directory
     883        String dir = new File(Main.pref.getUserDataDirectory(), "images").getAbsolutePath();
    884884        try {
    885885            u = getImageUrl(dir, imageName, additionalClassLoaders);
     
    952952            });
    953953
    954             CachedFile cf = new CachedFile(base + fn).setDestDir(new File(Main.pref.getPreferencesDir(), "images").toString());
     954            CachedFile cf = new CachedFile(base + fn).setDestDir(
     955                    new File(Main.pref.getUserDataDirectory(), "images").getPath());
    955956            try (InputStream is = cf.getInputStream()) {
    956957                parser.parse(new InputSource(is));
  • trunk/src/org/openstreetmap/josm/tools/PlatformHook.java

    r7831 r7834  
    134134     */
    135135    public File getDefaultPrefDirectory();
     136
     137    /**
     138     * Returns the platform-dependent default user data directory.
     139     * @return the platform-dependent default user data directory
     140     * @since 7834
     141     */
     142    public File getDefaultUserDataDirectory();
    136143}
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r7831 r7834  
    333333        return new File(System.getProperty("user.home")+"/Library/Preferences", "JOSM");
    334334    }
     335
     336    @Override
     337    public File getDefaultUserDataDirectory() {
     338        return new File(System.getProperty("user.home")+"/Library/Application Support", "JOSM");
     339    }
    335340}
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r7831 r7834  
    373373    @Override
    374374    public File getDefaultCacheDirectory() {
    375         return new File(Main.pref.getPreferencesDirFile(), "cache");
     375        return new File(Main.pref.getUserDataDirectory(), "cache");
    376376    }
    377377
     
    380380        return new File(System.getProperty("user.home"), ".josm");
    381381    }
     382
     383    @Override
     384    public File getDefaultUserDataDirectory() {
     385        // Use preferences directory by default
     386        return Main.pref.getPreferencesDirectory();
     387    }
    382388}
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r7833 r7834  
    287287    public File getDefaultCacheDirectory() {
    288288        String p = System.getenv("LOCALAPPDATA");
    289         if (p == null || "".equals(p)) {
     289        if (p == null || p.isEmpty()) {
     290            // Fallback for Windows OS earlier than Windows Vista, where the variable is not defined
    290291            p = System.getenv("APPDATA");
    291292        }
Note: See TracChangeset for help on using the changeset viewer.