From db55b507040d75aa5bb31c0f394bc80d49faf82c Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Thu, 16 Feb 2017 18:18:38 +0300 Subject: [PATCH] Update routing.xml while installing new version --- .../osmand/plus/resources/ResourceManager.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java index 8cd4642a2d..75b910e133 100644 --- a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java +++ b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java @@ -49,6 +49,7 @@ import net.osmand.plus.resources.AsyncLoadingThread.MapLoadRequest; import net.osmand.plus.resources.AsyncLoadingThread.TileLoadDownloadRequest; import net.osmand.plus.srtmplugin.SRTMPlugin; import net.osmand.plus.views.OsmandMapLayer.DrawSettings; +import net.osmand.router.RoutingConfiguration; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; @@ -552,6 +553,7 @@ public class ResourceManager { context.getSettings().PREVIOUS_INSTALLED_VERSION.set(fv); copyRegionsBoundaries(); copyPoiTypes(); + copyRoutingXml(); for (String internalStyle : context.getRendererRegistry().getInternalRenderers().keySet()) { File fl = context.getRendererRegistry().getFileForInternalStyle(internalStyle); if (fl.exists()) { @@ -596,6 +598,19 @@ public class ResourceManager { } } + private void copyRoutingXml() { + try { + File file = context.getAppPath(IndexConstants.ROUTING_XML_FILE); + if (file != null) { + FileOutputStream fout = new FileOutputStream(file); + Algorithms.streamCopy(RoutingConfiguration.class.getResourceAsStream("routing.xml"), fout); + fout.close(); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + private final static String ASSET_INSTALL_MODE__alwaysCopyOnFirstInstall = "alwaysCopyOnFirstInstall"; private final static String ASSET_COPY_MODE__overwriteOnlyIfExists = "overwriteOnlyIfExists"; private final static String ASSET_COPY_MODE__alwaysOverwriteOrCopy = "alwaysOverwriteOrCopy";