Skip to content

Commit

Permalink
fixed recursive progress for file deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
wolpi committed Sep 27, 2022
1 parent 4ef8009 commit addacef
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions primitiveFTPd/src/org/primftpd/ui/CleanSpaceActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,20 @@ protected java.lang.Void doInBackground(java.lang.Void[] objects) {
return null;
}

private void delete(File dir, boolean includeChildren, int counter) {
private int delete(File dir, boolean includeChildren, int counter) {
if (dir != null) {
for (File child : dir.listFiles()) {
if (child.isFile()) {
child.delete();
counter ++;
progressDiag.setProgress(counter);
} else if (child.isDirectory() && includeChildren) {
delete(child, true, counter);
counter = delete(child, true, counter);
child.delete();
}
}
}
return counter;
}

protected void onPostExecute(Void result) {
Expand Down

0 comments on commit addacef

Please sign in to comment.