Fixing for version 0.1.3
Dieser Commit ist enthalten in:
Ursprung
064a710c12
Commit
c6bbd58d18
11
pom.xml
11
pom.xml
@ -6,12 +6,12 @@
|
||||
|
||||
<groupId>de.chaos</groupId>
|
||||
<artifactId>swlnmngr</artifactId>
|
||||
<version>0.1.2</version>
|
||||
<version>0.1.3</version>
|
||||
<name>SteamWarLinkManager</name>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
@ -98,5 +98,10 @@
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.vatbub</groupId>
|
||||
<artifactId>mslinks</artifactId>
|
||||
<version>1.0.6.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -19,7 +19,7 @@ public class CLIConfig {
|
||||
options.addOption(new Option("d", "debug", false, "Set the Log Level to Debug"));
|
||||
options.addOption(new Option("c", "config", true, "Use another Config File"));
|
||||
options.addOption(new Option("i", "installdir", true, "Use other Install Dir"));
|
||||
options.addOption(new Option("u", "no-update", false, "Disable the Auto-Update Checker"));
|
||||
options.addOption(new Option("u", "update-checker", false, "Enable the Auto-Update Checker"));
|
||||
|
||||
CommandLine cli = null;
|
||||
CommandLineParser parser = new DefaultParser();
|
||||
|
@ -2,6 +2,7 @@ package de.chaos.swlnmngr.route.routes;
|
||||
|
||||
import de.chaos.swlnmngr.Main;
|
||||
import de.chaos.swlnmngr.config.CLIConfig;
|
||||
import mslinks.ShellLink;
|
||||
import org.apache.commons.lang.SystemUtils;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
@ -9,9 +10,13 @@ import org.json.JSONTokener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.nio.file.attribute.FileAttribute;
|
||||
import java.nio.file.attribute.PosixFilePermission;
|
||||
import java.util.Objects;
|
||||
|
||||
public class InstallRoute implements Route {
|
||||
@ -54,12 +59,30 @@ public class InstallRoute implements Route {
|
||||
Main.getLogger().error("Could not create SymLink", e);
|
||||
return false;
|
||||
}
|
||||
} else if(SystemUtils.IS_OS_WINDOWS) {
|
||||
try {
|
||||
ShellLink link = ShellLink.createLink(new File(CLIConfig.INSTALL_DIR, "swlnmngr.bat").getAbsolutePath(), new File(CLIConfig.INSTALL_DIR, "swlnmngr.lnk").getAbsolutePath()).setWorkingDir(CLIConfig.INSTALL_DIR.getAbsolutePath());
|
||||
link.getHeader().getLinkFlags().setRunAsUser();
|
||||
link.saveTo(new File(CLIConfig.INSTALL_DIR, "swlnmngr.lnk").getAbsolutePath());
|
||||
Files.writeString(new File(CLIConfig.INSTALL_DIR, "swlnmngr.bat").toPath(), Files.readString(new File(CLIConfig.INSTALL_DIR, "swlnmngr.bat").toPath()).replace("${iDir}", CLIConfig.INSTALL_DIR.getAbsolutePath()), StandardCharsets.UTF_8, StandardOpenOption.TRUNCATE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
Main.getLogger().error("Could not create Link", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File configFile = new File(installDir, "config.json");
|
||||
if(!configFile.exists()) {
|
||||
try {
|
||||
Files.copy(Objects.requireNonNull(InstallRoute.class.getResourceAsStream("/default_config.json")), configFile.toPath());
|
||||
String configStr = new String(Objects.requireNonNull(InstallRoute.class.getResourceAsStream("/default_config.json")).readAllBytes());
|
||||
if(SystemUtils.IS_OS_WINDOWS) {
|
||||
configStr = configStr.replace("~", System.getProperty("user.home"))
|
||||
.replace("\\", "\\\\")
|
||||
.replace("/", "\\\\")
|
||||
.replace("https:\\\\\\\\steamwar.de\\\\lib.php", "https://steamwar.de/lib.php");
|
||||
}
|
||||
Files.writeString(configFile.toPath(), configStr, StandardOpenOption.CREATE_NEW);
|
||||
} catch (IOException e) {
|
||||
Main.getLogger().error("Could not copy Config File", e);
|
||||
return false;
|
||||
|
@ -34,7 +34,7 @@ public class LinkRoute implements Route {
|
||||
Main.getLogger().error("No Project with name: {}", args[0]);
|
||||
return false;
|
||||
}
|
||||
File link = new File(projectDir, "libs");
|
||||
File link = new File(projectDir, "lib");
|
||||
try {
|
||||
Files.deleteIfExists(link.toPath());
|
||||
Main.getLogger().debug(libsFile);
|
||||
|
@ -1 +1,5 @@
|
||||
java -jar ./SteamWarLinkManager.jar %*
|
||||
set args=--help
|
||||
set /p args=Arguments:
|
||||
echo %args%
|
||||
java -jar ${iDir}\SteamWarLinkManager.jar %args% %*
|
||||
pause
|
In neuem Issue referenzieren
Einen Benutzer sperren