Initial commit

This commit is contained in:
2022-02-16 00:34:54 -05:00
parent 0d2d14cedc
commit 8c4c756a74
15 changed files with 405 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
package tech.nevets.jamlinstaller;
public class GUI {
}

View File

@@ -0,0 +1,57 @@
package tech.nevets.jamlinstaller;
import org.apache.commons.io.FileUtils;
import javax.swing.*;
import java.io.*;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
public class Main {
public static Path path = Path.of(System.getenv("APPDATA") + "\\.jaml\\");
public static void main(String[] args) {
makeDirs();
try {
copyAssets();
downloadJar(new URL("https://ci.nevets.tech/view/Minecraft/job/JAML/lastSuccessfulBuild/artifact/target/JAML-latest.jar"));
} catch (Exception e) {
e.printStackTrace();
}
}
public static void downloadJar(URL url) throws IOException {
FileUtils.copyURLToFile(url, new File(path + "\\jaml.jar"));
}
private static void makeDirs() {
try {
if (!path.toFile().exists()) {
path.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();
}
}
public static void copyAssets() throws IOException, URISyntaxException {
URL resource = Main.class.getResource("/assets/");
File assets = Paths.get(resource.toURI()).toFile();
FileUtils.copyDirectory(assets, new File(path + "\\assets\\"));
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB