将Settings中DEFAULT_PROFILE, HOME_PROFILE字段移至Profiles

This commit is contained in:
yushijinhun
2018-06-16 20:30:14 +08:00
parent 593159f4a6
commit 92e5eecaf2
2 changed files with 8 additions and 7 deletions

View File

@@ -20,14 +20,18 @@ package org.jackhuang.hmcl.setting;
import org.jackhuang.hmcl.Launcher;
public final class Profiles {
public static final String DEFAULT_PROFILE = "Default";
public static final String HOME_PROFILE = "Home";
private Profiles() {
}
public static String getProfileDisplayName(Profile profile) {
switch (profile.getName()) {
case Settings.DEFAULT_PROFILE:
case Profiles.DEFAULT_PROFILE:
return Launcher.i18n("profile.default");
case Settings.HOME_PROFILE:
case Profiles.HOME_PROFILE:
return Launcher.i18n("profile.home");
default:
return profile.getName();

View File

@@ -66,9 +66,6 @@ public class Settings {
.setPrettyPrinting()
.create();
public static final String DEFAULT_PROFILE = "Default";
public static final String HOME_PROFILE = "Home";
public static final String SETTINGS_FILE_NAME = "hmcl.json";
public static final File SETTINGS_FILE = new File(SETTINGS_FILE_NAME).getAbsoluteFile();
@@ -562,8 +559,8 @@ public class Settings {
private void checkProfileMap() {
if (getProfileMap().isEmpty()) {
getProfileMap().put(DEFAULT_PROFILE, new Profile(DEFAULT_PROFILE));
getProfileMap().put(HOME_PROFILE, new Profile(HOME_PROFILE, Launcher.MINECRAFT_DIRECTORY));
getProfileMap().put(Profiles.DEFAULT_PROFILE, new Profile(Profiles.DEFAULT_PROFILE));
getProfileMap().put(Profiles.HOME_PROFILE, new Profile(Profiles.HOME_PROFILE, Launcher.MINECRAFT_DIRECTORY));
}
}