Index: trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 12854)
+++ trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 12855)
@@ -927,5 +927,6 @@
      */
     private static ImageResource getIfAvailableHttp(String url, ImageType type) {
-        try (CachedFile cf = new CachedFile(url).setDestDir(new File(Main.pref.getCacheDirectory(), "images").getPath());
+        try (CachedFile cf = new CachedFile(url).setDestDir(
+                new File(Config.getDirs().getCacheDirectory(), "images").getPath());
              InputStream is = cf.getInputStream()) {
             switch (type) {
@@ -1172,6 +1173,6 @@
         }
         // Try user-data directory
-        if (Main.pref != null) {
-            String dir = new File(Main.pref.getUserDataDirectory(), "images").getAbsolutePath();
+        if (Config.getDirs() != null) {
+            String dir = new File(Config.getDirs().getUserDataDirectory(), "images").getAbsolutePath();
             try {
                 u = getImageUrl(dir, imageName, additionalClassLoaders);
@@ -1246,5 +1247,6 @@
             parser.setEntityResolver((publicId, systemId) -> new InputSource(new ByteArrayInputStream(new byte[0])));
 
-            try (CachedFile cf = new CachedFile(base + fn).setDestDir(new File(Main.pref.getUserDataDirectory(), "images").getPath());
+            try (CachedFile cf = new CachedFile(base + fn).setDestDir(
+                        new File(Config.getDirs().getUserDataDirectory(), "images").getPath());
                  InputStream is = cf.getInputStream()) {
                 parser.parse(new InputSource(is));
Index: trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java	(revision 12854)
+++ trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java	(revision 12855)
@@ -477,5 +477,5 @@
     public File getDefaultUserDataDirectory() {
         // Use preferences directory by default
-        return Main.pref.getPreferencesDirectory();
+        return Config.getDirs().getPreferencesDirectory();
     }
 
@@ -522,5 +522,5 @@
             props.load(fis);
             byte[] content = Files.readAllBytes(templateFile);
-            File cachePath = Main.pref.getCacheDirectory();
+            File cachePath = Config.getDirs().getCacheDirectory();
             Path fontconfigFile = cachePath.toPath().resolve("fontconfig.properties");
             OutputStream os = Files.newOutputStream(fontconfigFile);
Index: trunk/src/org/openstreetmap/josm/tools/RightAndLefthandTraffic.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/RightAndLefthandTraffic.java	(revision 12854)
+++ trunk/src/org/openstreetmap/josm/tools/RightAndLefthandTraffic.java	(revision 12855)
@@ -17,5 +17,4 @@
 import java.util.Set;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JoinAreasAction;
 import org.openstreetmap.josm.actions.JoinAreasAction.JoinAreasResult;
@@ -32,4 +31,5 @@
 import org.openstreetmap.josm.io.OsmWriter;
 import org.openstreetmap.josm.io.OsmWriterFactory;
+import org.openstreetmap.josm.spi.preferences.Config;
 
 /**
@@ -153,5 +153,5 @@
     private static void saveOptimizedBoundaries(Collection<Way> optimizedWays) {
         DataSet ds = optimizedWays.iterator().next().getDataSet();
-        File file = new File(Main.pref.getCacheDirectory(), "left-right-hand-traffic.osm");
+        File file = new File(Config.getDirs().getCacheDirectory(), "left-right-hand-traffic.osm");
         try (Writer writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);
              OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(writer), false, ds.getVersion())
@@ -166,5 +166,5 @@
 
     private static Collection<Way> loadOptimizedBoundaries() {
-        try (InputStream is = new FileInputStream(new File(Main.pref.getCacheDirectory(), "left-right-hand-traffic.osm"))) {
+        try (InputStream is = new FileInputStream(new File(Config.getDirs().getCacheDirectory(), "left-right-hand-traffic.osm"))) {
            return OsmReader.parseDataSet(is, null).getWays();
         } catch (IllegalDataException | IOException ex) {
