]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/function/cache/ManageCacheFunction.java
Version 16, February 2014
[GpsPrune.git] / tim / prune / function / cache / ManageCacheFunction.java
index 65565987529d3885d72a38d12a7b545317e22ed9..59ef13a9d1248eb9add927dbfe3f8ba53958a487 100644 (file)
@@ -365,8 +365,7 @@ public class ManageCacheFunction extends GenericFunction implements Runnable
                if (totalDeleted > 0)
                {
                        // Show confirmation message
-                       JOptionPane.showMessageDialog(_dialog, I18nManager.getText("dialog.diskcache.deleted1")
-                               + " " + totalDeleted + " " + I18nManager.getText("dialog.diskcache.deleted2"),
+                       JOptionPane.showMessageDialog(_dialog, I18nManager.getTextWithNumber("dialog.diskcache.deleted", totalDeleted),
                                I18nManager.getText(getNameKey()), JOptionPane.INFORMATION_MESSAGE);
                        // reload model
                        _cards.first(_cardPanel);
@@ -395,18 +394,13 @@ public class ManageCacheFunction extends GenericFunction implements Runnable
                                if (subdir.isDirectory()) {
                                        numDeleted += deleteFilesFrom(subdir, inMaxDays);
                                }
-                               else if (subdir.isFile() && subdir.exists())
+                               else if (subdir.isFile() && subdir.exists() && _TILEFILTER.accept(subdir))
                                {
-                                       boolean isTileFile = _TILEFILTER.accept(subdir);
-                                       boolean isBadFile = !isTileFile && subdir.getName().toLowerCase().endsWith("png");
-                                       if (isTileFile || isBadFile)
+                                       long fileAge = (now - subdir.lastModified()) / 1000 / 60 / 60 / 24;
+                                       if (inMaxDays < 0 || fileAge > inMaxDays)
                                        {
-                                               long fileAge = (now - subdir.lastModified()) / 1000 / 60 / 60 / 24;
-                                               if (inMaxDays < 0 || fileAge > inMaxDays || isBadFile)
-                                               {
-                                                       if (subdir.delete()) {
-                                                               numDeleted++;
-                                                       }
+                                               if (subdir.delete()) {
+                                                       numDeleted++;
                                                }
                                        }
                                }