|
56 | 56 | import me.itzg.helpers.json.ObjectMappers; |
57 | 57 | import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; |
58 | 58 | import org.apache.commons.compress.archivers.zip.ZipFile; |
| 59 | +import org.jetbrains.annotations.Nullable; |
59 | 60 | import reactor.core.publisher.Flux; |
60 | 61 | import reactor.core.publisher.Mono; |
61 | 62 | import reactor.core.scheduler.Schedulers; |
@@ -435,17 +436,19 @@ private Path locateWorldZipInRepo(String fileName) { |
435 | 436 | return locateFileIn(fileName, downloadsRepo, downloadsRepo.resolve(REPO_SUBDIR_WORLDS)); |
436 | 437 | } |
437 | 438 |
|
438 | | - private static Path locateFileIn(String fileName, Path... dirs) { |
| 439 | + private static Path locateFileIn(String fileName, @Nullable Path... dirs) { |
439 | 440 | for (Path dir : dirs) { |
440 | | - final Path resolved = dir.resolve(fileName); |
441 | | - if (Files.exists(resolved)) { |
442 | | - return resolved; |
443 | | - } |
| 441 | + if (dir != null) { |
| 442 | + final Path resolved = dir.resolve(fileName); |
| 443 | + if (Files.exists(resolved)) { |
| 444 | + return resolved; |
| 445 | + } |
444 | 446 |
|
445 | | - // When downloading, the browser may replace spaces with +'s |
446 | | - final Path altResolved = dir.resolve(fileName.replace(' ', '+')); |
447 | | - if (Files.exists(altResolved)) { |
448 | | - return altResolved; |
| 447 | + // When downloading, the browser may replace spaces with +'s |
| 448 | + final Path altResolved = dir.resolve(fileName.replace(' ', '+')); |
| 449 | + if (Files.exists(altResolved)) { |
| 450 | + return altResolved; |
| 451 | + } |
449 | 452 | } |
450 | 453 | } |
451 | 454 | return null; |
@@ -581,6 +584,7 @@ private ModPackResults processModpack(InstallContext context, |
581 | 584 | excludeIncludeIds.getForceIncludeIds(), |
582 | 585 | context.categoryInfo |
583 | 586 | ) |
| 587 | + .checkpoint() |
584 | 588 | ) |
585 | 589 | .collectList() |
586 | 590 | .block(); |
@@ -741,6 +745,7 @@ else if (category.getSlug().equals("worlds")) { |
741 | 745 | final Mono<ResolveResult> resolvedFileMono = |
742 | 746 | Mono.defer(() -> |
743 | 747 | downloadOrResolveFile(context, modInfo, isWorld, outputDir, cfFile) |
| 748 | + .checkpoint() |
744 | 749 | ) |
745 | 750 | // retry the deferred part above if one of the expected failure cases |
746 | 751 | .retryWhen( |
@@ -795,7 +800,10 @@ private Mono<ResolveResult> downloadOrResolveFile(InstallContext context, CurseF |
795 | 800 |
|
796 | 801 | // Will try to locate an existing file by alternate names that browser might create, |
797 | 802 | // but only for non-world files of the modpack |
798 | | - final Path locatedFile = !isWorld ? locateFileIn(cfFile.getFileName(), outputDir) : null; |
| 803 | + final Path locatedFile = !isWorld ? locateFileIn(cfFile.getFileName(), |
| 804 | + outputDir, |
| 805 | + downloadsRepo |
| 806 | + ) : null; |
799 | 807 |
|
800 | 808 | if (locatedFile != null) { |
801 | 809 | log.info("Mod file {} already exists", locatedFile); |
|
0 commit comments