Skip to content

Commit b921e75

Browse files
committed
Can't have shit working with Java
1 parent 7a29e66 commit b921e75

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

emuiigen/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
<dependency>
103103
<groupId>commons-io</groupId>
104104
<artifactId>commons-io</artifactId>
105-
<version>2.12.0</version>
105+
<version>2.13.0</version>
106106
</dependency>
107107
<dependency>
108108
<groupId>commons-net</groupId>

emuiigen/src/AmiiboAPI.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package com.xortroll.emuiibo.emuiigen
22

33
import org.json.JSONObject
44
import org.json.JSONArray
5+
import java.io.File
56
import java.io.FileWriter
67
import java.io.FileInputStream
7-
import java.net.URLDecoder
88
import java.nio.file.Path
99
import java.nio.file.Paths
1010
import org.apache.commons.io.IOUtils
@@ -35,8 +35,8 @@ class AmiiboAPI {
3535
}
3636

3737
fun readApi() : Map<String, List<AmiiboAPIEntry>>? {
38-
val cur_path = Path.of(URLDecoder.decode(this::class.java.getProtectionDomain().getCodeSource().getLocation().getPath(), "UTF-8")).parent;
39-
val local_api_json_path = Paths.get(cur_path.toAbsolutePath().toString(), "api.json").toString();
38+
val cur_path = File(this::class.java.getProtectionDomain().getCodeSource().getLocation().toURI()).parentFile.absolutePath;
39+
val local_api_json_path = Paths.get(cur_path, "api.json").toString();
4040

4141
try {
4242
val raw_json = Utils.netDownloadString(Url);

emuiigen/src/Utils.kt

+1-7
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,8 @@ class Utils {
2424
).toUShort()
2525
}
2626

27-
fun netDownloadBytes(url: String) : ByteArray {
28-
val strm = URL(url).openStream();
29-
return IOUtils.toByteArray(strm);
30-
}
31-
3227
fun netDownloadString(url: String) : String {
33-
val strm = URL(url).openStream();
34-
return IOUtils.toString(strm, StandardCharsets.UTF_8);
28+
return IOUtils.toString(URL(url));
3529
}
3630

3731
fun netDownloadFile(url: String, path: String) {

0 commit comments

Comments
 (0)