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