JAML/src/main/java/tech/nevets/jaml/JAML.java

76 lines
2.2 KiB
Java

package tech.nevets.jaml;
import org.simpleyaml.configuration.file.YamlFile;
import tech.nevets.jaml.gui.GuiHandler;
import tech.nevets.jaml.util.Config;
import tech.nevets.jaml.util.DiscordRP;
import tech.nevets.jaml.util.LoaderUtils;
import tech.nevets.jaml.util.ProfileUtils;
import java.nio.file.Path;
public class JAML {
//public static YamlFile config = Config.getConfig();
public static Path path;
public static GuiHandler guiHandler;
public static void main(String[] args) {
DiscordRP.start();
makeDirs();
Config.loadConfig();
ProfileUtils.getProfileList();
ProfileUtils.getActiveProfile();
LoaderUtils.getLoaders();
DiscordRP.update("", "");
guiHandler = new GuiHandler();
// try {
// System.out.println(VersionFetcher.getLatestVersion("release"));
// } catch (IOException e) {
// e.printStackTrace();
// }
}
private static void makeDirs() {
if (System.getenv("JAML_HOME") == null) {
path = Path.of(System.getenv("APPDATA") + "\\.jaml\\");
} else {
path = Path.of(System.getenv("JAML_HOME"));
}
try {
if (!path.toFile().exists()) {
path.toFile().mkdirs();
}
} catch (Exception e) {
System.out.println("Invalid path, please check your config.yml and try again");
}
try {
Path profilePath = Path.of(path + "\\profiles\\");
if (!profilePath.toFile().exists()) {
profilePath.toFile().mkdirs();
}
} catch (Exception e) {
e.printStackTrace();
}
try {
Path profilePath = Path.of(path + "\\assets\\");
if (!profilePath.toFile().exists()) {
profilePath.toFile().mkdirs();
}
} catch (Exception e) {
e.printStackTrace();
}
try {
Path dataPath = Path.of(path + "\\data\\");
if (!dataPath.toFile().exists()) {
dataPath.toFile().mkdirs();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}