Skip to content

Commit 17499d0

Browse files
author
nicol
committed
Private cards startup load bugfiix
1 parent d1ddf86 commit 17499d0

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/main/java/org/magic/api/providers/impl/PrivateMTGSetProvider.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,14 @@ private int indexOf(MagicCard mc, JsonArray arr) {
9999
return -1;
100100
}
101101

102-
private MagicEdition loadEditionnFromFile(File f) throws IOException {
103-
104-
if(getFile(CARDS).getCanonicalPath().startsWith(f.getCanonicalPath()))
102+
private MagicEdition loadEditionFromFile(File f) throws IOException {
103+
if(f.getCanonicalPath().startsWith(getFile("DIRECTORY").getCanonicalPath()))
105104
{
106105
var root = FileTools.readJson(f).getAsJsonObject();
107106
return serializer.fromJson(root.get("main").toString(), MagicEdition.class);
108107
}
109108

110-
throw new IOException("Path is incorrect");
109+
throw new IOException("Path is incorrect : "+f.getAbsolutePath());
111110

112111

113112
}
@@ -257,16 +256,15 @@ public MagicCard getCardByNumber(String id, MagicEdition me) throws IOException
257256
public List<MagicEdition> loadEditions() throws IOException {
258257
List<MagicEdition> ret = new ArrayList<>();
259258
for (File f : setDirectory.listFiles(pathname -> pathname.getName().endsWith(ext))) {
260-
ret.add(loadEditionnFromFile(f));
259+
ret.add(loadEditionFromFile(f));
261260
}
262-
263261
return ret;
264262
}
265263

266264
@Override
267265
public MagicEdition getSetById(String id){
268266
try {
269-
return loadEditionnFromFile(new File(setDirectory, id + ext));
267+
return loadEditionFromFile(new File(setDirectory, id + ext));
270268
} catch (IOException e) {
271269
return new MagicEdition(id,id);
272270
}

0 commit comments

Comments
 (0)