Merge branch 'subtree'
[nikiroo-utils.git] / src / be / nikiroo / fanfix / supported / Text.java
index c54b6a5d44ce0a328d63451420c6a9c00a82bd3c..e082a737f2a7be9c11b9fc133bea0c96f108ae55 100644 (file)
@@ -97,7 +97,7 @@ class Text extends BasicSupport {
                meta.setType(getType().toString());
                meta.setImageDocument(false);
                meta.setCover(getCover(getSourceFile()));
-
+               
                return meta;
        }
 
@@ -188,7 +188,7 @@ class Text extends BasicSupport {
                return content;
        }
 
-       private Image getCover(File sourceFile) {
+       protected Image getCover(File sourceFile) {
                String path = sourceFile.getName();
 
                for (String ext : new String[] { ".txt", ".text", ".story" }) {
@@ -317,7 +317,7 @@ class Text extends BasicSupport {
        }
 
        /**
-        * Remove the ".txt" extension if it is present.
+        * Remove the ".txt" (or ".text") extension if it is present.
         * 
         * @param file
         *            the file to process
@@ -326,9 +326,11 @@ class Text extends BasicSupport {
         *         was present
         */
        protected File assureNoTxt(File file) {
-               if (file.getName().endsWith(".txt")) {
-                       file = new File(file.getPath().substring(0,
-                                       file.getPath().length() - 4));
+               for (String ext : new String[] { ".txt", ".text" }) {
+                       if (file.getName().endsWith(ext)) {
+                               file = new File(file.getPath().substring(0,
+                                               file.getPath().length() - ext.length()));
+                       }
                }
 
                return file;