File tree 3 files changed +5
-11
lines changed
3 files changed +5
-11
lines changed Original file line number Diff line number Diff line change 102
102
<dependency >
103
103
<groupId >commons-io</groupId >
104
104
<artifactId >commons-io</artifactId >
105
- <version >2.12 .0</version >
105
+ <version >2.13 .0</version >
106
106
</dependency >
107
107
<dependency >
108
108
<groupId >commons-net</groupId >
Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ package com.xortroll.emuiibo.emuiigen
2
2
3
3
import org.json.JSONObject
4
4
import org.json.JSONArray
5
+ import java.io.File
5
6
import java.io.FileWriter
6
7
import java.io.FileInputStream
7
- import java.net.URLDecoder
8
8
import java.nio.file.Path
9
9
import java.nio.file.Paths
10
10
import org.apache.commons.io.IOUtils
@@ -35,8 +35,8 @@ class AmiiboAPI {
35
35
}
36
36
37
37
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();
40
40
41
41
try {
42
42
val raw_json = Utils .netDownloadString(Url );
Original file line number Diff line number Diff line change @@ -24,14 +24,8 @@ class Utils {
24
24
).toUShort()
25
25
}
26
26
27
- fun netDownloadBytes (url : String ) : ByteArray {
28
- val strm = URL (url).openStream();
29
- return IOUtils .toByteArray(strm);
30
- }
31
-
32
27
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));
35
29
}
36
30
37
31
fun netDownloadFile (url : String , path : String ) {
You can’t perform that action at this time.
0 commit comments