Ignore:
Timestamp:
2017-09-14T14:39:53+02:00 (2 years ago)
Author:
bastiK
Message:

see #15229 - add separate interface IBaseDirectories to look up pref, user data and cache dir

Location:
trunk/src/org/openstreetmap/josm/data
Files:
4 edited

Legend:

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

    r12853 r12855  
    4444
    4545import org.openstreetmap.josm.Main;
    46 import org.openstreetmap.josm.spi.preferences.AbstractPreferences;
    4746import org.openstreetmap.josm.data.preferences.BooleanProperty;
    4847import org.openstreetmap.josm.data.preferences.ColorProperty;
     
    6261import org.openstreetmap.josm.io.OfflineAccessException;
    6362import org.openstreetmap.josm.io.OnlineResource;
     63import org.openstreetmap.josm.spi.preferences.AbstractPreferences;
     64import org.openstreetmap.josm.spi.preferences.IBaseDirectories;
    6465import org.openstreetmap.josm.tools.CheckParameterUtil;
    6566import org.openstreetmap.josm.tools.ColorHelper;
     
    9293 * @since 74
    9394 */
    94 public class Preferences extends AbstractPreferences {
     95public class Preferences extends AbstractPreferences implements IBaseDirectories {
    9596
    9697    private static final String COLOR_PREFIX = "color.";
     
    331332     * @since 7834
    332333     */
     334    @Override
    333335    public File getPreferencesDirectory() {
    334336        if (preferencesDir != null)
     
    355357     * @since 7834
    356358     */
     359    @Override
    357360    public File getUserDataDirectory() {
    358361        if (userdataDir != null)
     
    404407     * @return the cache directory
    405408     */
     409    @Override
    406410    public File getCacheDirectory() {
    407411        if (cacheDir != null)
  • trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java

    r12813 r12855  
    2727import org.apache.commons.jcs.engine.control.CompositeCacheManager;
    2828import org.apache.commons.jcs.utils.serialization.StandardSerializer;
    29 import org.openstreetmap.josm.Main;
    3029import org.openstreetmap.josm.data.preferences.BooleanProperty;
    3130import org.openstreetmap.josm.data.preferences.IntegerProperty;
     31import org.openstreetmap.josm.spi.preferences.Config;
    3232import org.openstreetmap.josm.tools.Logging;
    3333import org.openstreetmap.josm.tools.Utils;
     
    101101    @SuppressWarnings("resource")
    102102    private static void initialize() throws IOException {
    103         File cacheDir = new File(Main.pref.getCacheDirectory(), "jcs");
     103        File cacheDir = new File(Config.getDirs().getCacheDirectory(), "jcs");
    104104
    105105        if (!cacheDir.exists() && !cacheDir.mkdirs())
  • trunk/src/org/openstreetmap/josm/data/imagery/CachedTileLoaderFactory.java

    r12846 r12855  
    1111import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader;
    1212import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener;
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.data.Version;
    1514import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
     
    5756        String defPath = null;
    5857        try {
    59             defPath = new File(Main.pref.getCacheDirectory(), "tiles").getAbsolutePath();
     58            defPath = new File(Config.getDirs().getCacheDirectory(), "tiles").getAbsolutePath();
    6059        } catch (SecurityException e) {
    6160            Logging.warn(e);
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r12846 r12855  
    176176     */
    177177    public static String getValidatorDir() {
    178         return new File(Main.pref.getUserDataDirectory(), "validator").getAbsolutePath();
     178        return new File(Config.getDirs().getUserDataDirectory(), "validator").getAbsolutePath();
    179179    }
    180180
Note: See TracChangeset for help on using the changeset viewer.