Some quick fixes
authorNiki Roo <niki@nikiroo.be>
Sun, 12 Feb 2017 11:01:10 +0000 (12:01 +0100)
committerNiki Roo <niki@nikiroo.be>
Sun, 12 Feb 2017 11:01:10 +0000 (12:01 +0100)
src/be/nikiroo/fanfix/Instance.java
src/be/nikiroo/fanfix/Main.java
src/be/nikiroo/fanfix/supported/InfoText.java

index 4e4705b352a5aa569cd958b4fc1244b004c1a227..71f42dd74103a68efc9cc6e78296d6d6ed0491ca 100644 (file)
@@ -48,7 +48,7 @@ public class Instance {
                                        tmp = new File(tmpDir, "fanfic-tmp");
                                }
                                if (readerTmp == null) {
-                                       tmp = new File(tmpDir, "fanfic-reader");
+                                       readerTmp = new File(tmpDir, "fanfic-reader");
                                }
                        } else {
                                syserr(new IOException(
index 10bccec650d7e4f9f33073502f553860e5f4229a..bb9aee5a5bdd8e4bd1e99125b1c2424145e7a23d 100644 (file)
@@ -62,7 +62,6 @@ public class Main {
                String typeString = null;
                String chapString = null;
                String target = null;
-               String readerTypeString = null;
                MainAction action = null;
                Boolean plusInfo = null;
 
@@ -153,11 +152,7 @@ public class Main {
                                exitCode = 255;
                                break;
                        case SET_READER:
-                               if (readerTypeString == null) {
-                                       readerTypeString = args[i];
-                               } else {
-                                       exitCode = 255;
-                               }
+                               exitCode = setReaderType(args[i]);
                                break;
                        }
                }
@@ -188,7 +183,6 @@ public class Main {
                                exitCode = 0;
                                break;
                        case SET_READER:
-                               exitCode = setReaderType(readerTypeString);
                                break;
                        }
                }
@@ -474,7 +468,8 @@ public class Main {
         */
        private static int setReaderType(String readerTypeString) {
                try {
-                       ReaderType readerType = ReaderType.valueOf(readerTypeString);
+                       ReaderType readerType = ReaderType.valueOf(readerTypeString
+                                       .toUpperCase());
                        BasicReader.setDefaultReaderType(readerType);
                        return 0;
                } catch (IllegalArgumentException e) {
index 021b8c0b47abec25bd328e01554aa0586b7e54f7..365c51a77377c2bd60f73cee26e576216b2d8e67 100644 (file)
@@ -230,12 +230,12 @@ class InfoText extends Text {
                        try {
                                String value = getLine(infoIn, key, 0);
                                if (value != null && !value.isEmpty()) {
-                                       value = value.trim().substring(key.length()).trim();
+                                       value = value.trim().substring(key.length() - 1).trim();
                                        if (value.startsWith("'") && value.endsWith("'")
                                                        || value.startsWith("\"") && value.endsWith("\"")) {
                                                value = value.substring(1, value.length() - 1).trim();
                                        }
-
+                                       
                                        return value;
                                }
                        } finally {