Bump Version and Fix some Bugs
Dieser Commit ist enthalten in:
Ursprung
d7ddcb7ec4
Commit
06529ddcc2
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>de.chaos</groupId>
|
||||
<artifactId>swlnmngr</artifactId>
|
||||
<version>0.1.1</version>
|
||||
<version>0.1.2</version>
|
||||
<name>SteamWarLinkManager</name>
|
||||
|
||||
<properties>
|
||||
|
@ -44,7 +44,7 @@ public class CLIConfig {
|
||||
if(cli.hasOption("i")) {
|
||||
INSTALL_DIR = new File(cli.getOptionValue("i"));
|
||||
} else {
|
||||
INSTALL_DIR = new File("~/.swlnmngr/");
|
||||
INSTALL_DIR = new File(System.getProperty("user.home"), ".swlnmngr/").toPath().normalize().toFile();
|
||||
}
|
||||
if(cli.hasOption("c")) {
|
||||
CONFIG = new File(cli.getOptionValue("c"));
|
||||
|
@ -1,7 +1,6 @@
|
||||
package de.chaos.swlnmngr.config;
|
||||
|
||||
import de.chaos.swlnmngr.Main;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
|
||||
@ -9,12 +8,11 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Config {
|
||||
|
||||
private static final File CONFIG_FILE = new File(CLIConfig.INSTALL_DIR, "config.json");
|
||||
private static File CONFIG_FILE = new File(CLIConfig.INSTALL_DIR, "config.json");
|
||||
|
||||
public static final File PROJECT_PATH;
|
||||
public static final File LIB_PATH;
|
||||
@ -29,13 +27,10 @@ public class Config {
|
||||
JSONObject config = null;
|
||||
try {
|
||||
if(!CONFIG_FILE.exists()) {
|
||||
if(CONFIG_FILE.getParentFile().mkdir()) {
|
||||
Main.getLogger().log(Level.DEBUG, "Created Config Folder");
|
||||
}
|
||||
Files.write(CONFIG_FILE.toPath(), Config.class.getResourceAsStream("/default_config.json").readAllBytes(), StandardOpenOption.CREATE_NEW);
|
||||
config = new JSONObject(new JSONTokener(Objects.requireNonNull(Config.class.getResourceAsStream("/default_config.json"))));
|
||||
} else {
|
||||
config = new JSONObject(new JSONTokener(new FileInputStream(CONFIG_FILE)));
|
||||
}
|
||||
|
||||
config = new JSONObject(new JSONTokener(new FileInputStream(CONFIG_FILE)));
|
||||
} catch (Exception e) {
|
||||
Main.getLogger().fatal("Could not load Config", e);
|
||||
System.exit(1);
|
||||
@ -53,8 +48,7 @@ public class Config {
|
||||
throw new SecurityException(e);
|
||||
}
|
||||
|
||||
JSONObject credentials = config.getJSONObject("credentials");
|
||||
USERNAME = credentials.getString("username");
|
||||
PASSWORD = credentials.getString("password");
|
||||
USERNAME = config.getString("username");
|
||||
PASSWORD = config.getString("password");
|
||||
}
|
||||
}
|
||||
|
@ -27,13 +27,19 @@ public class InstallRoute implements Route {
|
||||
public boolean route(String[] args) {
|
||||
File installDir = CLIConfig.INSTALL_DIR;
|
||||
if(!installDir.exists()) {
|
||||
installDir.mkdir();
|
||||
try {
|
||||
Files.createDirectories(CLIConfig.INSTALL_DIR.toPath());
|
||||
} catch (IOException e) {
|
||||
Main.getLogger().error("Could not create Install Directory", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (String defaultFile : defaultFiles) {
|
||||
String normalName = defaultFile.replace("default_", "");
|
||||
try {
|
||||
Files.copy(Objects.requireNonNull(InstallRoute.class.getResourceAsStream("/" + defaultFile)), new File(CLIConfig.INSTALL_DIR, normalName).toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
new File(CLIConfig.INSTALL_DIR, normalName).setExecutable(true, true);
|
||||
} catch (IOException e) {
|
||||
Main.getLogger().error("Could not create File", e);
|
||||
return false;
|
||||
|
@ -1 +1 @@
|
||||
java -jar ./SteamWarLinkManager.jar
|
||||
java -jar ./SteamWarLinkManager.jar %*
|
@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
java -jar ./SteamWarLinkManager.jar
|
||||
java -jar ./SteamWarLinkManager.jar $@
|
In neuem Issue referenzieren
Einen Benutzer sperren