Changeset 34479 in osm for applications/editors/josm/plugins/routes/src
- Timestamp:
- 2018-08-15T14:05:08+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RouteDefinition.java
r34477 r34479 8 8 import org.openstreetmap.josm.data.osm.search.SearchCompiler.Match; 9 9 import org.openstreetmap.josm.data.osm.search.SearchParseError; 10 import org.openstreetmap.josm.tools.Logging; 10 11 11 12 public class RouteDefinition { … … 24 25 } catch (SearchParseError e) { 25 26 match = new SearchCompiler.Never(); 26 e.printStackTrace();27 Logging.error(e); 27 28 } 28 29 } -
applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RoutesPlugin.java
r34477 r34479 4 4 import java.io.File; 5 5 import java.io.FileInputStream; 6 import java.io.FileOutputStream;7 6 import java.io.IOException; 8 7 import java.io.InputStream; 9 import java. io.OutputStream;8 import java.nio.file.Files; 10 9 import java.util.ArrayList; 11 10 import java.util.List; … … 37 36 MainApplication.getLayerManager().addLayerChangeListener(this); 38 37 39 File routesFile = new File(getPluginDirs().getUserDataDirectory( false), "routes.xml");38 File routesFile = new File(getPluginDirs().getUserDataDirectory(true), "routes.xml"); 40 39 if (!routesFile.exists()) { 41 40 Logging.info("File with route definitions doesn't exist, using default"); 42 43 try { 44 routesFile.getParentFile().mkdir(); 45 try ( 46 OutputStream outputStream = new FileOutputStream(routesFile); 47 InputStream inputStream = Routes.class.getResourceAsStream("routes.xml"); 48 ) { 49 byte[] b = new byte[512]; 50 int read; 51 while ((read = inputStream.read(b)) != -1) { 52 outputStream.write(b, 0, read); 53 } 54 } 41 try (InputStream inputStream = getClass().getResourceAsStream( 42 "/resources/org/openstreetmap/josm/plugins/routes/xml/routes.xml"); 43 ) { 44 Files.copy(inputStream, routesFile.toPath()); 55 45 } catch (IOException e) { 56 46 Logging.error(e);
Note:
See TracChangeset
for help on using the changeset viewer.