package tech.nevets.jaml; import org.simpleyaml.configuration.file.YamlFile; import tech.nevets.jaml.gui.GuiHandler; import java.io.IOException; import java.nio.file.Path; public class JAML { public static YamlFile config; public static Path path; public static DiscordRP drp = new DiscordRP(); public static GuiHandler guiHandler; public static Profile activeProfile; public static void main(String[] args) { makeDirs(); Config.loadConfig(); config = Config.getConfig(); try { Profiles pfs = new Profiles(); activeProfile = pfs.loadProfile(config.getString("launcher.default-profile")); } catch (IOException e) { System.out.println("Unable to load default profile: " + e.getMessage()); } drp.start(); guiHandler = new GuiHandler(); drp.shutdown(); } private static void makeDirs() { if (config == null) { path = Path.of(System.getenv("APPDATA") + "\\.jaml\\"); } else { if (config.getString("launcher.path") == "default") { path = Path.of(System.getenv("APPDATA") + "\\.jaml\\"); } else { path = Path.of(config.getString("launcher.path")); } } 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(); } } }