From dd8e27488cbdcab2dc87891d8b14163ad694aba8 Mon Sep 17 00:00:00 2001 From: Hiroshi Miura Date: Thu, 2 Sep 2021 15:12:21 +0900 Subject: [PATCH] Support dictionary_root/appendix/ folder when placing furoku, there can be placed on same folder with honmon. This patch allow user to place appendix/furoku onto like following; ``` dictionar_root/catalogs /subbook/data/honmon /appendix/catalogs /subbook/data/furoku ``` --- src/main/java/io/github/eb4j/ebview/EBDict.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/eb4j/ebview/EBDict.java b/src/main/java/io/github/eb4j/ebview/EBDict.java index d711dfa..36660dd 100644 --- a/src/main/java/io/github/eb4j/ebview/EBDict.java +++ b/src/main/java/io/github/eb4j/ebview/EBDict.java @@ -27,11 +27,17 @@ public class EBDict { private final SubBook[] subBooks; public EBDict(final File eBookDir) throws Exception { - String eBookDirectory = eBookDir.getPath(); Book eBookDictionary; + String eBookDirectory = eBookDir.getPath(); + String appendixDirectory; + if (new File(eBookDir, "appendix").isDirectory()) { + appendixDirectory = new File(eBookDir, "appendix").getPath(); + } else { + appendixDirectory = eBookDirectory; + } try { // try dictionary and appendix first. - eBookDictionary = new Book(eBookDirectory, eBookDirectory); + eBookDictionary = new Book(eBookDirectory, appendixDirectory); LOG.info("Load dictionary with appendix."); } catch (EBException ignore) { // There may be no appendix, try again with dictionary only.