X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FLocalLibrary.java;h=92676b3530288eac94244b9b84c4f23c24bd82c8;hb=e272f05fd49f01e9fb6bd71c7b74a32839bbcc38;hp=917ce093b20ebd8b58cad71a37a75d263c173490;hpb=62c63b0724f4bc45999cb2e7186b4b3ada479a0a;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/library/LocalLibrary.java b/src/be/nikiroo/fanfix/library/LocalLibrary.java index 917ce09..92676b3 100644 --- a/src/be/nikiroo/fanfix/library/LocalLibrary.java +++ b/src/be/nikiroo/fanfix/library/LocalLibrary.java @@ -131,7 +131,7 @@ public class LocalLibrary extends BasicLibrary { } @Override - protected void clearCache() { + protected void invalidateInfo(String luid) { stories = null; sourceCovers = new HashMap(); } @@ -147,6 +147,7 @@ public class LocalLibrary extends BasicLibrary { for (File file : getRelatedFiles(luid)) { // TODO: throw an IOException if we cannot delete the files? IOUtils.deltree(file); + file.getParentFile().delete(); } } @@ -157,7 +158,7 @@ public class LocalLibrary extends BasicLibrary { File expectedTarget = getExpectedFile(meta); expectedTarget.getParentFile().mkdirs(); - BasicOutput it = BasicOutput.getOutput(getOutputType(meta), true); + BasicOutput it = BasicOutput.getOutput(getOutputType(meta), true, true); it.process(story, expectedTarget.getPath(), pg); return story; @@ -182,15 +183,17 @@ public class LocalLibrary extends BasicLibrary { "\\.info$", ""); InfoCover.writeInfo(newDir, name, meta); relatedFile.delete(); + relatedFile.getParentFile().delete(); } catch (IOException e) { Instance.getTraceHandler().error(e); } } else { relatedFile.renameTo(new File(newDir, relatedFile.getName())); + relatedFile.getParentFile().delete(); } } - clearCache(); + invalidateInfo(); } @Override @@ -261,7 +264,7 @@ public class LocalLibrary extends BasicLibrary { pg.add(1); } - clearCache(); + invalidateInfo(); pg.done(); return; } @@ -269,7 +272,7 @@ public class LocalLibrary extends BasicLibrary { super.imprt(other, luid, pg); - clearCache(); + invalidateInfo(); } /** @@ -383,7 +386,8 @@ public class LocalLibrary extends BasicLibrary { } String coverExt = "." - + Instance.getConfig().getString(Config.IMAGE_FORMAT_COVER); + + Instance.getConfig().getString(Config.IMAGE_FORMAT_COVER) + .toLowerCase(); File coverFile = new File(path + coverExt); if (!coverFile.exists()) { coverFile = new File(path.substring(0, @@ -403,7 +407,7 @@ public class LocalLibrary extends BasicLibrary { * {@link LocalLibrary#baseDir}. *

* Will use a cached list when possible (see - * {@link BasicLibrary#clearCache()}). + * {@link BasicLibrary#invalidateInfo()}). * * @param pg * the optional {@link Progress} @@ -472,8 +476,10 @@ public class LocalLibrary extends BasicLibrary { } catch (IOException e) { // We should not have not-supported files in the // library - Instance.getTraceHandler().error(new IOException( - "Cannot load file from library: " + infoFile, e)); + Instance.getTraceHandler().error( + new IOException( + "Cannot load file from library: " + + infoFile, e)); } pgFiles.add(1); }