Changeset 34743 in osm for applications/editors/josm/plugins
- Timestamp:
- 2018-11-27T21:02:44+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/indoorhelper/src/org/openstreetmap/josm/plugins/indoorhelper/IndoorHelperPlugin.java
r34733 r34743 62 62 public IndoorHelperPlugin(PluginInformation info) throws IOException { 63 63 super(info); 64 exportValidator("/data/indoorhelper.validator.mapcss");65 64 exportStyleFile("sit.mapcss"); 66 65 exportStyleFile("entrance_door_icon.png"); … … 77 76 // Secures that the plug-in is only loaded, if a new MapFrame is created. 78 77 controller = new IndoorHelperController(); 79 }80 }81 82 /**83 * Exports the mapcss validator file to the preferences directory.84 * @param resourceName resource name85 * @throws IOException if any I/O error occurs86 */87 private void exportValidator(String resourceName) throws IOException {88 try (InputStream stream = IndoorHelperPlugin.class.getResourceAsStream(resourceName)) {89 if (stream == null) {90 throw new IOException("Cannot get resource \"" + resourceName + "\" from Jar file.");91 }92 93 File valDir = new File(Config.getDirs().getUserDataDirectory(true), "validator");94 valDir.mkdirs();95 String outPath = valDir.getAbsolutePath() +sep+ "indoorhelper.validator.mapcss";96 97 try (OutputStream resStreamOut = new FileOutputStream(outPath)) {98 int readBytes;99 byte[] buffer = new byte[4096];100 while ((readBytes = stream.read(buffer)) > 0) {101 resStreamOut.write(buffer, 0, readBytes);102 }103 }104 78 } 105 79 }
Note:
See TracChangeset
for help on using the changeset viewer.