Skip to content

Commit e51eff4

Browse files
Avoid container filename conflicts
1 parent 538a9a1 commit e51eff4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/gg/essential/ad/EssentialUtil.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ public static boolean installationCompleted() {
4242
public static boolean installContainer() {
4343
try {
4444
Path destination = Paths.get("mods", "essential-container.jar");
45-
if (Files.exists(destination)) throw new RuntimeException("fix me!"); // fixme filename conflicts
45+
if (Files.exists(destination)) {
46+
int i = 1;
47+
do {
48+
destination = Paths.get("mods", "essential-container-" + i + ".jar");
49+
i++;
50+
} while (Files.exists(destination));
51+
}
4652
try (InputStream is = EssentialUtil.class.getResourceAsStream("container.jarx")) {
4753
if (is == null) throw new IllegalStateException("No bundled container jar found!");
4854
Files.copy(is, destination);

0 commit comments

Comments
 (0)