mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-08-03 19:36:53 -04:00
parent
7cdf4504d1
commit
b69602b735
@ -151,18 +151,24 @@ public class HMCLGameRepository extends DefaultGameRepository {
|
|||||||
|
|
||||||
Version fromVersion = getVersion(srcId);
|
Version fromVersion = getVersion(srcId);
|
||||||
|
|
||||||
if (Files.exists(dstDir)) throw new IOException("Version exists");
|
List<String> blackList = new ArrayList<>(ModAdviser.MODPACK_BLACK_LIST);
|
||||||
FileUtils.copyDirectory(srcDir, dstDir);
|
blackList.add(srcId + ".jar");
|
||||||
|
blackList.add(srcId + ".json");
|
||||||
|
if (!copySaves)
|
||||||
|
blackList.add("saves");
|
||||||
|
|
||||||
Path fromJson = dstDir.resolve(srcId + ".json");
|
if (Files.exists(dstDir)) throw new IOException("Version exists");
|
||||||
Path fromJar = dstDir.resolve(srcId + ".jar");
|
FileUtils.copyDirectory(srcDir, dstDir, path -> Modpack.acceptFile(path, blackList, null));
|
||||||
|
|
||||||
|
Path fromJson = srcDir.resolve(srcId + ".json");
|
||||||
|
Path fromJar = srcDir.resolve(srcId + ".jar");
|
||||||
Path toJson = dstDir.resolve(dstId + ".json");
|
Path toJson = dstDir.resolve(dstId + ".json");
|
||||||
Path toJar = dstDir.resolve(dstId + ".jar");
|
Path toJar = dstDir.resolve(dstId + ".jar");
|
||||||
|
|
||||||
if (Files.exists(fromJar)) {
|
if (Files.exists(fromJar)) {
|
||||||
Files.move(fromJar, toJar);
|
Files.copy(fromJar, toJar);
|
||||||
}
|
}
|
||||||
Files.move(fromJson, toJson);
|
Files.copy(fromJson, toJson);
|
||||||
|
|
||||||
FileUtils.writeText(toJson.toFile(), JsonUtils.GSON.toJson(fromVersion.setId(dstId)));
|
FileUtils.writeText(toJson.toFile(), JsonUtils.GSON.toJson(fromVersion.setId(dstId)));
|
||||||
|
|
||||||
@ -176,12 +182,6 @@ public class HMCLGameRepository extends DefaultGameRepository {
|
|||||||
File srcGameDir = getRunDirectory(srcId);
|
File srcGameDir = getRunDirectory(srcId);
|
||||||
File dstGameDir = getRunDirectory(dstId);
|
File dstGameDir = getRunDirectory(dstId);
|
||||||
|
|
||||||
List<String> blackList = new ArrayList<>(ModAdviser.MODPACK_BLACK_LIST);
|
|
||||||
blackList.add(srcId + ".jar");
|
|
||||||
blackList.add(srcId + ".json");
|
|
||||||
if (!copySaves)
|
|
||||||
blackList.add("saves");
|
|
||||||
|
|
||||||
if (originalGameDirType != GameDirectoryType.VERSION_FOLDER)
|
if (originalGameDirType != GameDirectoryType.VERSION_FOLDER)
|
||||||
FileUtils.copyDirectory(srcGameDir.toPath(), dstGameDir.toPath(), path -> Modpack.acceptFile(path, blackList, null));
|
FileUtils.copyDirectory(srcGameDir.toPath(), dstGameDir.toPath(), path -> Modpack.acceptFile(path, blackList, null));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user