| 528 | | ZipEntry entry = zipFile.getEntry(full_name); |
| | 529 | |
| | 530 | ZipEntry entry = null; |
| | 531 | entry = zipFile.getEntry(full_name); |
| | 532 | |
| | 533 | // Issue #8686: Allow ZIP files whose paths are relative to the ZIP root in JOSM's map styling |
| | 534 | if (entry == null) { |
| | 535 | // Find the mapcss file to use as the path root |
| | 536 | Enumeration<? extends ZipEntry> entries = zipFile.entries(); |
| | 537 | String mapCssPath = ""; |
| | 538 | ZipEntry testEntry; |
| | 539 | while (entries.hasMoreElements()) { |
| | 540 | testEntry = entries.nextElement(); |
| | 541 | if (testEntry.getName().endsWith(".mapcss")) { |
| | 542 | mapCssPath = testEntry.getName(); |
| | 543 | break; |
| | 544 | } |
| | 545 | } |
| | 546 | String zipPathPrefix = mapCssPath.substring(0, mapCssPath.lastIndexOf("/")); |
| | 547 | if (zipPathPrefix.length() > 0) { |
| | 548 | zipPathPrefix += "/"; |
| | 549 | } |
| | 550 | entry = zipFile.getEntry(zipPathPrefix + full_name); |
| | 551 | } |
| | 552 | /// |
| | 553 | |