From b1c14da7e417d128c52e6bfed1bc1267500c3771 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sun, 22 Feb 2015 14:50:36 -0800 Subject: [PATCH] Try harder to create the initial instance folder on update. --- launcher/src/main/java/com/skcraft/launcher/Instance.java | 8 ++++++-- .../main/java/com/skcraft/launcher/update/Updater.java | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/launcher/src/main/java/com/skcraft/launcher/Instance.java b/launcher/src/main/java/com/skcraft/launcher/Instance.java index 9fa4a02..d8ebf59 100644 --- a/launcher/src/main/java/com/skcraft/launcher/Instance.java +++ b/launcher/src/main/java/com/skcraft/launcher/Instance.java @@ -8,11 +8,13 @@ package com.skcraft.launcher; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.io.Files; import com.skcraft.launcher.launch.JavaProcessBuilder; import com.skcraft.launcher.model.modpack.LaunchModifier; import lombok.Data; import java.io.File; +import java.io.IOException; import java.net.URL; import java.util.Date; @@ -69,8 +71,10 @@ public class Instance implements Comparable { @JsonIgnore public File getContentDir() { File dir = new File(this.dir, "minecraft"); - if (!dir.exists()) { - dir.mkdirs(); + try { + Files.createParentDirs(dir); + dir.mkdir(); + } catch (IOException ignored) { } return dir; } diff --git a/launcher/src/main/java/com/skcraft/launcher/update/Updater.java b/launcher/src/main/java/com/skcraft/launcher/update/Updater.java index e1a1905..70fa583 100644 --- a/launcher/src/main/java/com/skcraft/launcher/update/Updater.java +++ b/launcher/src/main/java/com/skcraft/launcher/update/Updater.java @@ -66,6 +66,9 @@ public class Updater extends BaseUpdater implements Callable, Progress public Instance call() throws Exception { log.info("Checking for an update for '" + instance.getName() + "'..."); + // Force the directory to be created + instance.getContentDir(); + boolean updateRequired = !instance.isInstalled(); boolean updateDesired = (instance.isUpdatePending() || updateRequired); boolean updateCapable = (instance.getManifestURL() != null);