+
+ /**
+ * Return the associated TXT source file if it can be found.
+ *
+ * @param source
+ * the source URL
+ *
+ * @return the supported source text file or NULL
+ */
+ private static File getTxt(URL source) {
+ try {
+ File fakeFile = new File(source.toURI());
+ if (fakeFile.getName().equals("index.html")) { // "story/index.html"
+ fakeFile = new File(fakeFile.getParent()); // -> "story/"
+ }
+
+ if (fakeFile.isDirectory()) { // "story/"
+ fakeFile = new File(fakeFile, fakeFile.getName() + ".txt"); // "story/story.txt"
+ }
+
+ if (fakeFile.getName().endsWith(".txt")) {
+ return fakeFile;
+ }
+ } catch (Exception e) {
+ }
+
+ return null;
+ }