X-Git-Url: http://git.nikiroo.be/?p=nikiroo-utils.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FText.java;h=e082a737f2a7be9c11b9fc133bea0c96f108ae55;hp=c54b6a5d44ce0a328d63451420c6a9c00a82bd3c;hb=d9691f01bac1ea36d234f240534ae8bb94ab522a;hpb=008b697abad5333455de13c773206495ee2b7530 diff --git a/src/be/nikiroo/fanfix/supported/Text.java b/src/be/nikiroo/fanfix/supported/Text.java index c54b6a5..e082a73 100644 --- a/src/be/nikiroo/fanfix/supported/Text.java +++ b/src/be/nikiroo/fanfix/supported/Text.java @@ -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;