From: Svjatoslav Agejenko Date: Sat, 2 Nov 2013 23:00:31 +0000 (+0200) Subject: bugfix X-Git-Tag: meviz-1.0~72 X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=d9c80f1c1b5cd3cccb681bddcc2b13a312cf9a1f;p=meviz.git bugfix --- diff --git a/src/main/java/eu/svjatoslav/meviz/htmlindexer/FilesystemIndexer.java b/src/main/java/eu/svjatoslav/meviz/htmlindexer/FilesystemIndexer.java index d9726dd..58244f0 100755 --- a/src/main/java/eu/svjatoslav/meviz/htmlindexer/FilesystemIndexer.java +++ b/src/main/java/eu/svjatoslav/meviz/htmlindexer/FilesystemIndexer.java @@ -42,8 +42,6 @@ public class FilesystemIndexer extends AbstractIndexer { private final File directoryToIndex; - private String thumbnailsPath; - private File metadataFile; private DirectoryMetadata metadata; @@ -96,14 +94,6 @@ public class FilesystemIndexer extends AbstractIndexer { return Utils.isMevizGeneratedIndexFile(indexFile); } - public void cleanupUnusedMetadataFiles() { - final File thumbnailsDirectory = new File(thumbnailsPath); - - for (final File file : thumbnailsDirectory.listFiles()) - if (!validMetadataFiles.contains(file.getName())) - file.delete(); - } - public void generateHtmlFromMetadata(final HashSet layouts) { // Generate HTML from metadata for (final Layout layout : layouts) @@ -156,7 +146,9 @@ public class FilesystemIndexer extends AbstractIndexer { .getRelativeThumbnailFileName(desiredDimension); validMetadataFiles.add(thumbnailFileName); - final File thumbnailFile = new File(thumbnailsPath + thumbnailFileName); + final File thumbnailFile = new File( + Utils.getThumbnailsDirectoryPath(directoryToIndex) + + thumbnailFileName); if (!thumbnailFile.exists()) { @@ -209,16 +201,18 @@ public class FilesystemIndexer extends AbstractIndexer { } public void loadOrCreateMetadata() { - metadataFile = new File(thumbnailsPath + Constants.METADATA_FILE_NAME); + + metadataFile = new File( + Utils.getThumbnailsDirectoryPath(directoryToIndex) + + Constants.METADATA_FILE_NAME); metadata = MetadadaHelper.initDirectoryMetadata(metadataFile); } private void removeUnusedThumbnailFiles() { - final File thumbnailsDirectory = new File(thumbnailsPath); - - for (final File file : thumbnailsDirectory.listFiles()) + for (final File file : Utils.getThumbnailsDirectory(directoryToIndex) + .listFiles()) if (!validMetadataFiles.contains(file.getName())) file.delete(); diff --git a/src/main/java/eu/svjatoslav/meviz/htmlindexer/Utils.java b/src/main/java/eu/svjatoslav/meviz/htmlindexer/Utils.java index f8c82fa..ab711a5 100755 --- a/src/main/java/eu/svjatoslav/meviz/htmlindexer/Utils.java +++ b/src/main/java/eu/svjatoslav/meviz/htmlindexer/Utils.java @@ -87,8 +87,12 @@ public class Utils { } public static File getThumbnailsDirectory(final File directoryToIndex) { - return new File(directoryToIndex.getAbsolutePath() + "/" - + Constants.THUMBNAILS_DIRECTORY_NAME + "/"); + return new File(getThumbnailsDirectoryPath(directoryToIndex)); + } + + public static String getThumbnailsDirectoryPath(final File directoryToIndex) { + return directoryToIndex.getAbsolutePath() + "/" + + Constants.THUMBNAILS_DIRECTORY_NAME + "/"; } public static boolean isMevizGeneratedIndexFile(final File indexFile)