Prevent from potential conflict that a MultiMC modpack has ".minecraft" and "minecraft" at the same time
This commit is contained in:
@@ -63,7 +63,6 @@ public final class MultiMCModpackInstallTask extends Task {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.repository = dependencyManager.getGameRepository();
|
this.repository = dependencyManager.getGameRepository();
|
||||||
|
|
||||||
File run = repository.getRunDirectory(name);
|
|
||||||
File json = repository.getModpackConfiguration(name);
|
File json = repository.getModpackConfiguration(name);
|
||||||
if (repository.hasVersion(name) && !json.exists())
|
if (repository.hasVersion(name) && !json.exists())
|
||||||
throw new IllegalArgumentException("Version " + name + " already exists.");
|
throw new IllegalArgumentException("Version " + name + " already exists.");
|
||||||
@@ -89,6 +88,17 @@ public final class MultiMCModpackInstallTask extends Task {
|
|||||||
if (event.isFailed())
|
if (event.isFailed())
|
||||||
repository.removeVersionFromDisk(name);
|
repository.removeVersionFromDisk(name);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Task> getDependencies() {
|
||||||
|
return dependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void preExecute() throws Exception {
|
||||||
|
File run = repository.getRunDirectory(name);
|
||||||
|
File json = repository.getModpackConfiguration(name);
|
||||||
|
|
||||||
ModpackConfiguration<MultiMCInstanceConfiguration> config = null;
|
ModpackConfiguration<MultiMCInstanceConfiguration> config = null;
|
||||||
try {
|
try {
|
||||||
@@ -102,13 +112,12 @@ public final class MultiMCModpackInstallTask extends Task {
|
|||||||
} catch (JsonParseException | IOException ignore) {
|
} catch (JsonParseException | IOException ignore) {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependents.add(new ModpackInstallTask<>(zipFile, run, modpack.getEncoding(), "/" + manifest.getName() + "/minecraft", any -> true, config));
|
try (FileSystem fs = CompressingUtils.readonly(zipFile.toPath()).setEncoding(modpack.getEncoding()).build()) {
|
||||||
|
if (Files.exists(fs.getPath("/" + manifest.getName() + "/.minecraft")))
|
||||||
dependents.add(new ModpackInstallTask<>(zipFile, run, modpack.getEncoding(), "/" + manifest.getName() + "/.minecraft", any -> true, config));
|
dependents.add(new ModpackInstallTask<>(zipFile, run, modpack.getEncoding(), "/" + manifest.getName() + "/.minecraft", any -> true, config));
|
||||||
|
else if (Files.exists(fs.getPath("/" + manifest.getName() + "/minecraft")))
|
||||||
|
dependents.add(new ModpackInstallTask<>(zipFile, run, modpack.getEncoding(), "/" + manifest.getName() + "/minecraft", any -> true, config));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Task> getDependencies() {
|
|
||||||
return dependencies;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user