This commit is contained in:
sirjonasxx 2018-11-07 17:20:30 +01:00
parent 8b13fd5ee9
commit 3dc77492c0
3 changed files with 10 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import org.json.JSONObject;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.List; import java.util.List;
@ -18,7 +19,11 @@ public class Cacher {
private static final String CACHE_FILENAME = "cache.json"; private static final String CACHE_FILENAME = "cache.json";
private static String getCacheDir() { private static String getCacheDir() {
return new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent(); try {
return new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParent();
} catch (URISyntaxException e) {
return null;
}
} }
private static boolean cacheFileExists() { private static boolean cacheFileExists() {

View File

@ -79,10 +79,11 @@ public class WindowsHabboClient extends HabboClient {
} }
} }
String g_winmem = new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI()).getParent() + "\\G-WinMem.exe";
if (!useCache) if (!useCache)
pb = new ProcessBuilder(new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI()).getParent() + "\\G-WinMem.exe", hConnection.getClientHostAndPort().substring(0, hConnection.getClientHostAndPort().indexOf(':')) , Integer.toString(hConnection.getPort())); pb = new ProcessBuilder(g_winmem, hConnection.getClientHostAndPort().substring(0, hConnection.getClientHostAndPort().indexOf(':')) , Integer.toString(hConnection.getPort()));
else else
pb = new ProcessBuilder(new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI()).getParent() + "\\G-WinMem.exe", hConnection.getClientHostAndPort().substring(0, hConnection.getClientHostAndPort().indexOf(':')) , Integer.toString(hConnection.getPort()), "-c" + joiner.toString()); pb = new ProcessBuilder(g_winmem, hConnection.getClientHostAndPort().substring(0, hConnection.getClientHostAndPort().indexOf(':')) , Integer.toString(hConnection.getPort()), "-c" + joiner.toString());
Process p = pb.start(); Process p = pb.start();

View File

@ -20,7 +20,7 @@ public class NormalExtensionRunner implements ExtensionRunner {
static { static {
String value; String value;
try { try {
value = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getParent(); value = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParent();
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
value = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent(); value = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent();
e.printStackTrace(); e.printStackTrace();