Changeset 21191 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java
- Timestamp:
- 2010-05-09T02:00:54+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java
r20931 r21191 73 73 74 74 private void checkDirSize(File path) { 75 long size = 0; 76 long oldestFileDate = Long.MAX_VALUE; 77 int oldestFile = 0; 78 File[] files = path.listFiles(); 79 for (int i = 0; i < files.length; i++) { 80 size += files[i].length(); 81 if (files[i].lastModified() < oldestFileDate) { 82 oldestFile = i; 83 oldestFileDate = files[i].lastModified(); 84 } 85 } 86 if (size > cacheSize*1024*1024) { 87 System.out.println("Delete oldest file \""+ files[oldestFile].getName() 88 + "\" in cache dir to stay under the limit of " + cacheSize + " MB."); 89 files[oldestFile].delete(); 90 checkDirSize(path); 75 if (cacheSize != 0) { 76 long size = 0; 77 long oldestFileDate = Long.MAX_VALUE; 78 int oldestFile = 0; 79 File[] files = path.listFiles(); 80 for (int i = 0; i < files.length; i++) { 81 size += files[i].length(); 82 if (files[i].lastModified() < oldestFileDate) { 83 oldestFile = i; 84 oldestFileDate = files[i].lastModified(); 85 } 86 } 87 if (size > (long)cacheSize*1024*1024) { 88 System.out.println("Delete oldest file \""+ files[oldestFile].getName() 89 + "\" in cache dir to stay under the limit of " + cacheSize + " MB."); 90 files[oldestFile].delete(); 91 checkDirSize(path); 92 } 91 93 } 92 94 }
Note:
See TracChangeset
for help on using the changeset viewer.