fix: unable to rename game versions that do not have jar file in directory.
This commit is contained in:
@@ -216,13 +216,15 @@ public class DefaultGameRepository implements GameRepository {
|
|||||||
Path toJson = toDir.resolve(to + ".json");
|
Path toJson = toDir.resolve(to + ".json");
|
||||||
Path toJar = toDir.resolve(to + ".jar");
|
Path toJar = toDir.resolve(to + ".jar");
|
||||||
|
|
||||||
|
boolean hasJarFile = Files.exists(fromJar);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Files.move(fromJson, toJson);
|
Files.move(fromJson, toJson);
|
||||||
Files.move(fromJar, toJar);
|
if (hasJarFile) Files.move(fromJar, toJar);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// recovery
|
// recovery
|
||||||
Lang.ignoringException(() -> Files.move(toJson, fromJson));
|
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));
|
Lang.ignoringException(() -> Files.move(toDir, fromDir));
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user