aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/StaticMapsProvider.java
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2011-11-16 19:27:19 +0100
committerSamuel Tardieu <sam@rfc1149.net>2011-11-16 19:32:54 +0100
commit31da7083b1e708034d0220e454afe8d992adedfd (patch)
treeadcb1645820835022ea000ddd0d0f0edc484fcc1 /main/src/cgeo/geocaching/StaticMapsProvider.java
parent21bf94937ab7e021536a2b07d42a637230cd4d15 (diff)
downloadcgeo-31da7083b1e708034d0220e454afe8d992adedfd.zip
cgeo-31da7083b1e708034d0220e454afe8d992adedfd.tar.gz
cgeo-31da7083b1e708034d0220e454afe8d992adedfd.tar.bz2
Create directories only when we will write a file
The directory structure should not be created when we are trying to read a file, especially if this file is located into the secondary storage area where we look "just in case". This fixes #802.
Diffstat (limited to 'main/src/cgeo/geocaching/StaticMapsProvider.java')
-rw-r--r--main/src/cgeo/geocaching/StaticMapsProvider.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/StaticMapsProvider.java b/main/src/cgeo/geocaching/StaticMapsProvider.java
index 34ebd3d..7f4587d 100644
--- a/main/src/cgeo/geocaching/StaticMapsProvider.java
+++ b/main/src/cgeo/geocaching/StaticMapsProvider.java
@@ -21,8 +21,8 @@ public class StaticMapsProvider {
*/
private static final int MIN_MAP_IMAGE_BYTES = 6000;
- public static File getMapFile(final String geocode, final int level) {
- return LocalStorage.getStorageFile(geocode, "map_" + level, false);
+ public static File getMapFile(final String geocode, final int level, final boolean createDirs) {
+ return LocalStorage.getStorageFile(geocode, "map_" + level, false, createDirs);
}
private static void downloadMapsInThread(final cgCache cache, String latlonMap, int edge, String waypoints) {
@@ -39,7 +39,7 @@ public class StaticMapsProvider {
final String url = mapUrl + "&zoom=" + zoom + "&size=" + edge + "x" + edge + "&maptype=" + mapType + "&markers=icon%3A" + markerUrl + "%7C" + latlonMap + waypoints + "&sensor=false";
- final File file = getMapFile(cache.getGeocode(), level);
+ final File file = getMapFile(cache.getGeocode(), level, true);
final HttpResponse httpResponse = cgBase.request(url, null, false);
if (httpResponse != null) {