source: josm/trunk/scripts/TagInfoExtract.java@ 16321

Last change on this file since 16321 was 16321, checked in by simon04, 4 years ago

fix #18907 - Initialize Territories+RightAndLefthandTraffic together, remove "Edit boundaries" to save memory (unless started with --debug)

File size: 26.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2
3import java.awt.Graphics2D;
4import java.awt.image.BufferedImage;
5import java.io.BufferedReader;
6import java.io.IOException;
7import java.io.OutputStream;
8import java.io.StringWriter;
9import java.io.UncheckedIOException;
10import java.io.Writer;
11import java.nio.file.Files;
12import java.nio.file.Path;
13import java.nio.file.Paths;
14import java.time.Instant;
15import java.time.ZoneId;
16import java.time.format.DateTimeFormatter;
17import java.util.ArrayList;
18import java.util.Arrays;
19import java.util.Collection;
20import java.util.Collections;
21import java.util.EnumSet;
22import java.util.LinkedHashMap;
23import java.util.List;
24import java.util.Locale;
25import java.util.Map;
26import java.util.Optional;
27import java.util.Set;
28import java.util.regex.Matcher;
29import java.util.regex.Pattern;
30import java.util.stream.Collectors;
31import java.util.stream.Stream;
32
33import javax.imageio.ImageIO;
34import javax.json.Json;
35import javax.json.JsonArrayBuilder;
36import javax.json.JsonObjectBuilder;
37import javax.json.JsonWriter;
38import javax.json.stream.JsonGenerator;
39
40import org.openstreetmap.josm.actions.DeleteAction;
41import org.openstreetmap.josm.command.DeleteCommand;
42import org.openstreetmap.josm.data.Preferences;
43import org.openstreetmap.josm.data.Version;
44import org.openstreetmap.josm.data.coor.LatLon;
45import org.openstreetmap.josm.data.osm.Node;
46import org.openstreetmap.josm.data.osm.OsmPrimitive;
47import org.openstreetmap.josm.data.osm.Tag;
48import org.openstreetmap.josm.data.osm.Way;
49import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings;
50import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer;
51import org.openstreetmap.josm.data.preferences.JosmBaseDirectories;
52import org.openstreetmap.josm.data.preferences.JosmUrls;
53import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry;
54import org.openstreetmap.josm.data.preferences.sources.SourceEntry;
55import org.openstreetmap.josm.data.projection.ProjectionRegistry;
56import org.openstreetmap.josm.data.projection.Projections;
57import org.openstreetmap.josm.gui.NavigatableComponent;
58import org.openstreetmap.josm.gui.mappaint.Cascade;
59import org.openstreetmap.josm.gui.mappaint.Environment;
60import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
61import org.openstreetmap.josm.gui.mappaint.MultiCascade;
62import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory;
63import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule;
64import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
65import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser;
66import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException;
67import org.openstreetmap.josm.gui.mappaint.styleelement.AreaElement;
68import org.openstreetmap.josm.gui.mappaint.styleelement.LineElement;
69import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement;
70import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference;
71import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset;
72import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader;
73import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetType;
74import org.openstreetmap.josm.gui.tagging.presets.items.CheckGroup;
75import org.openstreetmap.josm.gui.tagging.presets.items.KeyedItem;
76import org.openstreetmap.josm.io.CachedFile;
77import org.openstreetmap.josm.io.OsmTransferException;
78import org.openstreetmap.josm.spi.preferences.Config;
79import org.openstreetmap.josm.tools.Http1Client;
80import org.openstreetmap.josm.tools.HttpClient;
81import org.openstreetmap.josm.tools.Logging;
82import org.openstreetmap.josm.tools.OptionParser;
83import org.openstreetmap.josm.tools.RightAndLefthandTraffic;
84import org.openstreetmap.josm.tools.Territories;
85import org.openstreetmap.josm.tools.Utils;
86import org.xml.sax.SAXException;
87
88/**
89 * Extracts tag information for the taginfo project.
90 * <p>
91 * Run from the base directory of a JOSM checkout:
92 * <p>
93 * java -cp dist/josm-custom.jar TagInfoExtract --type mappaint
94 * java -cp dist/josm-custom.jar TagInfoExtract --type presets
95 * java -cp dist/josm-custom.jar TagInfoExtract --type external_presets
96 */
97public class TagInfoExtract {
98
99 /**
100 * Main method.
101 * @param args Main program arguments
102 * @throws Exception if any error occurs
103 */
104 public static void main(String[] args) throws Exception {
105 HttpClient.setFactory(Http1Client::new);
106 TagInfoExtract script = new TagInfoExtract();
107 script.parseCommandLineArguments(args);
108 script.init();
109 switch (script.options.mode) {
110 case MAPPAINT:
111 script.new StyleSheet().run();
112 break;
113 case PRESETS:
114 script.new Presets().run();
115 break;
116 case EXTERNAL_PRESETS:
117 script.new ExternalPresets().run();
118 break;
119 default:
120 throw new IllegalStateException("Invalid type " + script.options.mode);
121 }
122 if (!script.options.noexit) {
123 System.exit(0);
124 }
125 }
126
127 enum Mode {
128 MAPPAINT, PRESETS, EXTERNAL_PRESETS
129 }
130
131 private final Options options = new Options();
132
133 /**
134 * Parse command line arguments.
135 * @param args command line arguments
136 */
137 private void parseCommandLineArguments(String[] args) {
138 if (args.length == 1 && "--help".equals(args[0])) {
139 this.usage();
140 }
141 final OptionParser parser = new OptionParser(getClass().getName());
142 parser.addArgumentParameter("type", OptionParser.OptionCount.REQUIRED, options::setMode);
143 parser.addArgumentParameter("input", OptionParser.OptionCount.OPTIONAL, options::setInputFile);
144 parser.addArgumentParameter("output", OptionParser.OptionCount.OPTIONAL, options::setOutputFile);
145 parser.addArgumentParameter("imgdir", OptionParser.OptionCount.OPTIONAL, options::setImageDir);
146 parser.addArgumentParameter("imgurlprefix", OptionParser.OptionCount.OPTIONAL, options::setImageUrlPrefix);
147 parser.addFlagParameter("noexit", options::setNoExit);
148 parser.addFlagParameter("help", this::usage);
149 parser.parseOptionsOrExit(Arrays.asList(args));
150 }
151
152 private void usage() {
153 System.out.println("java " + getClass().getName());
154 System.out.println(" --type TYPE\tthe project type to be generated: " + Arrays.toString(Mode.values()));
155 System.out.println(" --input FILE\tthe input file to use (overrides defaults for types mappaint, presets)");
156 System.out.println(" --output FILE\tthe output file to use (defaults to STDOUT)");
157 System.out.println(" --imgdir DIRECTORY\tthe directory to put the generated images in (default: " + options.imageDir + ")");
158 System.out.println(" --imgurlprefix STRING\timage URLs prefix for generated image files (public path on webserver)");
159 System.out.println(" --noexit\tdo not call System.exit(), for use from Ant script");
160 System.out.println(" --help\tshow this help");
161 System.exit(0);
162 }
163
164 private static class Options {
165 Mode mode;
166 int josmSvnRevision = Version.getInstance().getVersion();
167 Path baseDir = Paths.get("");
168 Path imageDir = Paths.get("taginfo-img");
169 String imageUrlPrefix;
170 CachedFile inputFile;
171 Path outputFile;
172 boolean noexit;
173
174 void setMode(String value) {
175 mode = Mode.valueOf(value.toUpperCase(Locale.ENGLISH));
176 switch (mode) {
177 case MAPPAINT:
178 inputFile = new CachedFile("resource://styles/standard/elemstyles.mapcss");
179 break;
180 case PRESETS:
181 inputFile = new CachedFile("resource://data/defaultpresets.xml");
182 break;
183 default:
184 inputFile = null;
185 }
186 }
187
188 void setInputFile(String value) {
189 inputFile = new CachedFile(value);
190 }
191
192 void setOutputFile(String value) {
193 outputFile = Paths.get(value);
194 }
195
196 void setImageDir(String value) {
197 imageDir = Paths.get(value);
198 }
199
200 void setImageUrlPrefix(String value) {
201 imageUrlPrefix = value;
202 }
203
204 void setNoExit() {
205 noexit = true;
206 }
207
208 /**
209 * Determine full image url (can refer to JOSM or OSM repository).
210 * @param path the image path
211 * @return full image url
212 */
213 private String findImageUrl(String path) {
214 final Path f = baseDir.resolve("resources").resolve("images").resolve(path);
215 if (Files.exists(f)) {
216 return "https://josm.openstreetmap.de/export/" + josmSvnRevision + "/josm/trunk/resources/images/" + path;
217 }
218 throw new IllegalStateException("Cannot find image url for " + path);
219 }
220 }
221
222 private abstract class Extractor {
223 abstract void run() throws Exception;
224
225 void writeJson(String name, String description, Iterable<TagInfoTag> tags) throws IOException {
226 try (Writer writer = options.outputFile != null ? Files.newBufferedWriter(options.outputFile) : new StringWriter();
227 JsonWriter json = Json
228 .createWriterFactory(Collections.singletonMap(JsonGenerator.PRETTY_PRINTING, true))
229 .createWriter(writer)) {
230 JsonObjectBuilder project = Json.createObjectBuilder()
231 .add("name", name)
232 .add("description", description)
233 .add("project_url", JosmUrls.getInstance().getJOSMWebsite())
234 .add("icon_url", options.findImageUrl("logo_16x16x8.png"))
235 .add("contact_name", "JOSM developer team")
236 .add("contact_email", "josm-dev@openstreetmap.org");
237 final JsonArrayBuilder jsonTags = Json.createArrayBuilder();
238 for (TagInfoTag t : tags) {
239 jsonTags.add(t.toJson());
240 }
241 json.writeObject(Json.createObjectBuilder()
242 .add("data_format", 1)
243 .add("data_updated", DateTimeFormatter.ofPattern("yyyyMMdd'T'hhmmss'Z'").withZone(ZoneId.of("Z")).format(Instant.now()))
244 .add("project", project)
245 .add("tags", jsonTags)
246 .build());
247 if (options.outputFile == null) {
248 System.out.println(writer.toString());
249 }
250 }
251 }
252
253 }
254
255 private class Presets extends Extractor {
256
257 @Override
258 void run() throws IOException, OsmTransferException, SAXException {
259 try (BufferedReader reader = options.inputFile.getContentReader()) {
260 Collection<TaggingPreset> presets = TaggingPresetReader.readAll(reader, true);
261 List<TagInfoTag> tags = convertPresets(presets, "", true);
262 Logging.info("Converting {0} internal presets", tags.size());
263 writeJson("JOSM main presets", "Tags supported by the default presets in the OSM editor JOSM", tags);
264 }
265 }
266
267 List<TagInfoTag> convertPresets(Iterable<TaggingPreset> presets, String descriptionPrefix, boolean addImages) {
268 final List<TagInfoTag> tags = new ArrayList<>();
269 final Map<Tag, TagInfoTag> optionalTags = new LinkedHashMap<>();
270 for (TaggingPreset preset : presets) {
271 preset.data.stream()
272 .flatMap(item -> item instanceof KeyedItem
273 ? Stream.of(((KeyedItem) item))
274 : item instanceof CheckGroup
275 ? ((CheckGroup) item).checks.stream()
276 : Stream.empty())
277 .forEach(item -> {
278 for (String value : item.getValues()) {
279 Set<TagInfoTag.Type> types = TagInfoTag.Type.forPresetTypes(preset.types);
280 if (item.isKeyRequired()) {
281 tags.add(new TagInfoTag(descriptionPrefix + preset.getName(), item.key, value, types,
282 addImages && preset.iconName != null ? options.findImageUrl(preset.iconName) : null));
283 } else {
284 optionalTags.compute(new Tag(item.key, value), (osmTag, tagInfoTag) -> {
285 if (tagInfoTag == null) {
286 String description = descriptionPrefix + "Optional for: " + preset.getName();
287 return new TagInfoTag(description, item.key, value, types, null);
288 } else {
289 tagInfoTag.descriptions.add(preset.getName());
290 tagInfoTag.objectTypes.addAll(types);
291 return tagInfoTag;
292 }
293 });
294 }
295 }
296 });
297 }
298 tags.addAll(optionalTags.values());
299 return tags;
300 }
301
302 }
303
304 private class ExternalPresets extends Presets {
305
306 @Override
307 void run() throws IOException, OsmTransferException, SAXException {
308 TaggingPresetReader.setLoadIcons(false);
309 final Collection<ExtendedSourceEntry> sources = new TaggingPresetPreference.TaggingPresetSourceEditor().loadAndGetAvailableSources();
310 final List<TagInfoTag> tags = new ArrayList<>();
311 for (SourceEntry source : sources) {
312 if (source.url.startsWith("resource")) {
313 // default presets
314 continue;
315 }
316 try {
317 Logging.info("Loading {0}", source.url);
318 Collection<TaggingPreset> presets = TaggingPresetReader.readAll(source.url, false);
319 final List<TagInfoTag> t = convertPresets(presets, source.title + " ", false);
320 Logging.info("Converting {0} presets of {1}", t.size(), source.title);
321 tags.addAll(t);
322 } catch (Exception ex) {
323 Logging.warn("Skipping {0} due to error", source.url);
324 Logging.warn(ex);
325 }
326
327 }
328 writeJson("JOSM user presets", "Tags supported by the user contributed presets in the OSM editor JOSM", tags);
329 }
330 }
331
332 private class StyleSheet extends Extractor {
333 private MapCSSStyleSource styleSource;
334
335 @Override
336 void run() throws IOException, ParseException {
337 init();
338 parseStyleSheet();
339 final List<TagInfoTag> tags = convertStyleSheet();
340 writeJson("JOSM main mappaint style", "Tags supported by the main mappaint style in the OSM editor JOSM", tags);
341 }
342
343 /**
344 * Read the style sheet file and parse the MapCSS code.
345 * @throws IOException if any I/O error occurs
346 * @throws ParseException in case of parsing error
347 */
348 private void parseStyleSheet() throws IOException, ParseException {
349 try (BufferedReader reader = options.inputFile.getContentReader()) {
350 MapCSSParser parser = new MapCSSParser(reader, MapCSSParser.LexicalState.DEFAULT);
351 styleSource = new MapCSSStyleSource("");
352 styleSource.url = "";
353 parser.sheet(styleSource);
354 }
355 }
356
357 /**
358 * Collect all the tag from the style sheet.
359 * @return list of taginfo tags
360 */
361 private List<TagInfoTag> convertStyleSheet() {
362 return styleSource.rules.stream()
363 .flatMap(rule -> rule.selectors.stream())
364 .flatMap(selector -> selector.getConditions().stream())
365 .filter(ConditionFactory.SimpleKeyValueCondition.class::isInstance)
366 .map(ConditionFactory.SimpleKeyValueCondition.class::cast)
367 .map(condition -> condition.asTag(null))
368 .distinct()
369 .map(tag -> {
370 String iconUrl = null;
371 final EnumSet<TagInfoTag.Type> types = EnumSet.noneOf(TagInfoTag.Type.class);
372 Optional<String> nodeUrl = new NodeChecker(tag).findUrl(true);
373 if (nodeUrl.isPresent()) {
374 iconUrl = nodeUrl.get();
375 types.add(TagInfoTag.Type.NODE);
376 }
377 Optional<String> wayUrl = new WayChecker(tag).findUrl(iconUrl == null);
378 if (wayUrl.isPresent()) {
379 if (iconUrl == null) {
380 iconUrl = wayUrl.get();
381 }
382 types.add(TagInfoTag.Type.WAY);
383 }
384 Optional<String> areaUrl = new AreaChecker(tag).findUrl(iconUrl == null);
385 if (areaUrl.isPresent()) {
386 if (iconUrl == null) {
387 iconUrl = areaUrl.get();
388 }
389 types.add(TagInfoTag.Type.AREA);
390 }
391 return new TagInfoTag(null, tag.getKey(), tag.getValue(), types, iconUrl);
392 })
393 .collect(Collectors.toList());
394 }
395
396 /**
397 * Check if a certain tag is supported by the style as node / way / area.
398 */
399 private abstract class Checker {
400 private final Pattern reservedChars = Pattern.compile("[<>:\"|\\?\\*]");
401
402 Checker(Tag tag) {
403 this.tag = tag;
404 }
405
406 Environment applyStylesheet(OsmPrimitive osm) {
407 osm.put(tag);
408 MultiCascade mc = new MultiCascade();
409
410 Environment env = new Environment(osm, mc, null, styleSource);
411 for (MapCSSRule r : styleSource.rules) {
412 env.clearSelectorMatchingInformation();
413 if (r.matches(env)) {
414 // ignore selector range
415 if (env.layer == null) {
416 env.layer = "default";
417 }
418 r.execute(env);
419 }
420 }
421 env.layer = "default";
422 return env;
423 }
424
425 /**
426 * Create image file from StyleElement.
427 * @param element style element
428 * @param type object type
429 * @param nc navigatable component
430 *
431 * @return the URL
432 */
433 String createImage(StyleElement element, final String type, NavigatableComponent nc) {
434 BufferedImage img = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
435 Graphics2D g = img.createGraphics();
436 g.setClip(0, 0, 16, 16);
437 StyledMapRenderer renderer = new StyledMapRenderer(g, nc, false);
438 renderer.getSettings(false);
439 element.paintPrimitive(osm, MapPaintSettings.INSTANCE, renderer, false, false, false);
440 final String imageName = type + "_" + normalize(tag.toString()) + ".png";
441 try (OutputStream out = Files.newOutputStream(options.imageDir.resolve(imageName))) {
442 ImageIO.write(img, "png", out);
443 } catch (IOException e) {
444 throw new UncheckedIOException(e);
445 }
446 final String baseUrl = options.imageUrlPrefix != null ? options.imageUrlPrefix : options.imageDir.toString();
447 return baseUrl + "/" + imageName;
448 }
449
450 /**
451 * Normalizes tag so that it can used as a filename on all platforms, including Windows.
452 * @param tag OSM tag, that can contain illegal path characters
453 * @return OSM tag with all illegal path characters replaced by underscore ('_')
454 */
455 String normalize(String tag) {
456 Matcher m = reservedChars.matcher(tag);
457 return m.find() ? m.replaceAll("_") : tag;
458 }
459
460 /**
461 * Checks, if tag is supported and find URL for image icon in this case.
462 *
463 * @param generateImage if true, create or find a suitable image icon and return URL,
464 * if false, just check if tag is supported and return true or false
465 * @return URL for image icon if tag is supported
466 */
467 abstract Optional<String> findUrl(boolean generateImage);
468
469 protected Tag tag;
470 protected OsmPrimitive osm;
471 }
472
473 private class NodeChecker extends Checker {
474 NodeChecker(Tag tag) {
475 super(tag);
476 }
477
478 @Override
479 Optional<String> findUrl(boolean generateImage) {
480 this.osm = new Node(LatLon.ZERO);
481 Environment env = applyStylesheet(osm);
482 Cascade c = env.mc.getCascade("default");
483 Object image = c.get("icon-image");
484 if (image instanceof MapPaintStyles.IconReference && !((MapPaintStyles.IconReference) image).isDeprecatedIcon()) {
485 return Optional.of(options.findImageUrl(((MapPaintStyles.IconReference) image).iconName));
486 }
487 return Optional.empty();
488 }
489
490 }
491
492 private class WayChecker extends Checker {
493 WayChecker(Tag tag) {
494 super(tag);
495 }
496
497 @Override
498 Optional<String> findUrl(boolean generateImage) {
499 this.osm = new Way();
500 NavigatableComponent nc = new NavigatableComponent();
501 Node n1 = new Node(nc.getLatLon(2, 8));
502 Node n2 = new Node(nc.getLatLon(14, 8));
503 ((Way) osm).addNode(n1);
504 ((Way) osm).addNode(n2);
505 Environment env = applyStylesheet(osm);
506 LineElement les = LineElement.createLine(env);
507 if (les != null) {
508 if (!generateImage) return Optional.of("");
509 return Optional.of(createImage(les, "way", nc));
510 }
511 return Optional.empty();
512 }
513
514 }
515
516 private class AreaChecker extends Checker {
517 AreaChecker(Tag tag) {
518 super(tag);
519 }
520
521 @Override
522 Optional<String> findUrl(boolean generateImage) {
523 this.osm = new Way();
524 NavigatableComponent nc = new NavigatableComponent();
525 Node n1 = new Node(nc.getLatLon(2, 2));
526 Node n2 = new Node(nc.getLatLon(14, 2));
527 Node n3 = new Node(nc.getLatLon(14, 14));
528 Node n4 = new Node(nc.getLatLon(2, 14));
529 ((Way) osm).addNode(n1);
530 ((Way) osm).addNode(n2);
531 ((Way) osm).addNode(n3);
532 ((Way) osm).addNode(n4);
533 ((Way) osm).addNode(n1);
534 Environment env = applyStylesheet(osm);
535 AreaElement aes = AreaElement.create(env);
536 if (aes != null) {
537 if (!generateImage) return Optional.of("");
538 return Optional.of(createImage(aes, "area", nc));
539 }
540 return Optional.empty();
541 }
542 }
543 }
544
545 /**
546 * POJO representing a <a href="https://wiki.openstreetmap.org/wiki/Taginfo/Projects">Taginfo tag</a>.
547 */
548 private static class TagInfoTag {
549 final Collection<String> descriptions = new ArrayList<>();
550 final String key;
551 final String value;
552 final Set<Type> objectTypes;
553 final String iconURL;
554
555 TagInfoTag(String description, String key, String value, Set<Type> objectTypes, String iconURL) {
556 if (description != null) {
557 this.descriptions.add(description);
558 }
559 this.key = key;
560 this.value = value;
561 this.objectTypes = objectTypes;
562 this.iconURL = iconURL;
563 }
564
565 JsonObjectBuilder toJson() {
566 final JsonObjectBuilder object = Json.createObjectBuilder();
567 if (!descriptions.isEmpty()) {
568 object.add("description", String.join(", ", Utils.limit(descriptions, 8, "...")));
569 }
570 object.add("key", key);
571 object.add("value", value);
572 if ((!objectTypes.isEmpty())) {
573 final JsonArrayBuilder types = Json.createArrayBuilder();
574 objectTypes.stream().map(Enum::name).map(String::toLowerCase).forEach(types::add);
575 object.add("object_types", types);
576 }
577 if (iconURL != null) {
578 object.add("icon_url", iconURL);
579 }
580 return object;
581 }
582
583 enum Type {
584 NODE, WAY, AREA, RELATION;
585
586 static TagInfoTag.Type forPresetType(TaggingPresetType type) {
587 switch (type) {
588 case CLOSEDWAY:
589 return AREA;
590 case MULTIPOLYGON:
591 return RELATION;
592 default:
593 return valueOf(type.toString());
594 }
595 }
596
597 static Set<TagInfoTag.Type> forPresetTypes(Set<TaggingPresetType> types) {
598 if (types == null) {
599 return Collections.emptySet();
600 }
601 return types.stream()
602 .map(Type::forPresetType)
603 .collect(Collectors.toCollection(() -> EnumSet.noneOf(Type.class)));
604 }
605 }
606 }
607
608 /**
609 * Initialize the script.
610 * @throws IOException if any I/O error occurs
611 */
612 private void init() throws IOException {
613 Logging.setLogLevel(Logging.LEVEL_INFO);
614 Preferences.main().enableSaveOnPut(false);
615 Config.setPreferencesInstance(Preferences.main());
616 Config.setBaseDirectoriesProvider(JosmBaseDirectories.getInstance());
617 Config.setUrlsProvider(JosmUrls.getInstance());
618 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857"));
619 Path tmpdir = Files.createTempDirectory(options.baseDir, "pref");
620 tmpdir.toFile().deleteOnExit();
621 System.setProperty("josm.home", tmpdir.toString());
622 DeleteCommand.setDeletionCallback(DeleteAction.defaultDeletionCallback);
623 Territories.initializeInternalData();
624 Files.createDirectories(options.imageDir);
625 }
626}
Note: See TracBrowser for help on using the repository browser.