mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-02-17 17:09:55 +08:00
fix: unable to rename game versions that do not have jar file in directory.
This commit is contained in:
parent
85a9a21e57
commit
192a0c987e
@ -216,13 +216,15 @@ public class DefaultGameRepository implements GameRepository {
|
||||
Path toJson = toDir.resolve(to + ".json");
|
||||
Path toJar = toDir.resolve(to + ".jar");
|
||||
|
||||
boolean hasJarFile = Files.exists(fromJar);
|
||||
|
||||
try {
|
||||
Files.move(fromJson, toJson);
|
||||
Files.move(fromJar, toJar);
|
||||
if (hasJarFile) Files.move(fromJar, toJar);
|
||||
} catch (IOException e) {
|
||||
// recovery
|
||||
Lang.ignoringException(() -> Files.move(toJson, fromJson));
|
||||
Lang.ignoringException(() -> Files.move(toJar, fromJar));
|
||||
if (hasJarFile) Lang.ignoringException(() -> Files.move(toJar, fromJar));
|
||||
Lang.ignoringException(() -> Files.move(toDir, fromDir));
|
||||
throw e;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user