File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,13 @@ public boolean accept(File dir, String fileName) {
113113
114114 @Override
115115 public void dropChunks(int era) throws IOException {
116+ // here comes a Java 6 compatible version - fits to android SDK 23
117+ String eraPathName = this.rootDirectory + "/" + Integer.toString(era);
118+ File dir = new File(eraPathName);
119+
120+ String[] dirEntries = dir.list();
121+
122+ /*
116123 Path dir = Paths.get(this.rootDirectory + "/" + Integer.toString(era));
117124
118125 DirectoryStream<Path> entries = null;
@@ -128,9 +135,24 @@ public void dropChunks(int era) throws IOException {
128135 File file = path.toFile();
129136 file.delete();
130137 }
138+ */
139+ if(dirEntries != null) {
140+ for(String fileName : dirEntries) {
141+ File fileInDir = new File(eraPathName + "/" + fileName);
142+ try {
143+ fileInDir.delete();
144+ }
145+ catch(RuntimeException e) {
146+ System.err.println("AASPStorageFS: cannot remove old file:" + e.getLocalizedMessage());
147+ // try next
148+ }
149+ }
150+ }
131151
132152 // finally remove directory itself
133- dir.toFile().delete();
153+ // dir.toFile().delete();
154+
155+ dir.delete();
134156 }
135157
136158 String getRootPath() {
You can’t perform that action at this time.
0 commit comments