Skip to content

Commit

Permalink
Added default profile: Home whose default game directory is $USER/.mi…
Browse files Browse the repository at this point in the history
…necraft
  • Loading branch information
huanghongxun committed Mar 11, 2016
1 parent 156de24 commit e7d0624
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ public Profile() {
}

public Profile(String name) {
this(name, IOUtils.currentDir().getPath());
}

public Profile(String name, String gameDir) {
this.name = name;
gameDir = MCUtils.getInitGameDir().getPath();
this.gameDir = gameDir;
}

public Profile(String name, Profile v) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.jackhuang.hellominecraft.util.C;
import org.jackhuang.hellominecraft.util.logging.HMCLog;
import org.jackhuang.hellominecraft.launcher.Main;
import org.jackhuang.hellominecraft.launcher.core.MCUtils;
import org.jackhuang.hellominecraft.launcher.core.download.DownloadType;
import org.jackhuang.hellominecraft.util.CollectionUtils;
import org.jackhuang.hellominecraft.util.EventHandler;
Expand All @@ -40,6 +41,7 @@
public final class Settings {

public static final String DEFAULT_PROFILE = "Default";
public static final String HOME_PROFILE = "Home";

public static final File SETTINGS_FILE = new File(IOUtils.currentDir(), "hmcl.json");

Expand All @@ -55,7 +57,9 @@ public static Config getInstance() {
SETTINGS.downloadTypeChangedEvent.register(DownloadType::setSuggestedDownloadType);
DownloadType.setSuggestedDownloadType(SETTINGS.getDownloadSource());
if (!getProfiles().containsKey(DEFAULT_PROFILE))
getProfiles().put(DEFAULT_PROFILE, new Profile());
getProfiles().put(DEFAULT_PROFILE, new Profile(DEFAULT_PROFILE));
if (!getProfiles().containsKey(HOME_PROFILE))
getProfiles().put(HOME_PROFILE, new Profile(HOME_PROFILE, MCUtils.getLocation().getPath()));

for (Map.Entry<String, Profile> entry : getProfiles().entrySet()) {
Profile e = entry.getValue();
Expand Down

0 comments on commit e7d0624

Please sign in to comment.