1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2024-11-27 12:46:22 +01:00

Try harder to create the initial instance folder on update.

This commit is contained in:
sk89q 2015-02-22 14:50:36 -08:00
parent a08825b7ba
commit b1c14da7e4
2 changed files with 9 additions and 2 deletions

View File

@ -8,11 +8,13 @@ package com.skcraft.launcher;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.io.Files;
import com.skcraft.launcher.launch.JavaProcessBuilder; import com.skcraft.launcher.launch.JavaProcessBuilder;
import com.skcraft.launcher.model.modpack.LaunchModifier; import com.skcraft.launcher.model.modpack.LaunchModifier;
import lombok.Data; import lombok.Data;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.Date; import java.util.Date;
@ -69,8 +71,10 @@ public class Instance implements Comparable<Instance> {
@JsonIgnore @JsonIgnore
public File getContentDir() { public File getContentDir() {
File dir = new File(this.dir, "minecraft"); File dir = new File(this.dir, "minecraft");
if (!dir.exists()) { try {
dir.mkdirs(); Files.createParentDirs(dir);
dir.mkdir();
} catch (IOException ignored) {
} }
return dir; return dir;
} }

View File

@ -66,6 +66,9 @@ public class Updater extends BaseUpdater implements Callable<Instance>, Progress
public Instance call() throws Exception { public Instance call() throws Exception {
log.info("Checking for an update for '" + instance.getName() + "'..."); log.info("Checking for an update for '" + instance.getName() + "'...");
// Force the directory to be created
instance.getContentDir();
boolean updateRequired = !instance.isInstalled(); boolean updateRequired = !instance.isInstalled();
boolean updateDesired = (instance.isUpdatePending() || updateRequired); boolean updateDesired = (instance.isUpdatePending() || updateRequired);
boolean updateCapable = (instance.getManifestURL() != null); boolean updateCapable = (instance.getManifestURL() != null);