blob: d83827cc80bc64fd28e3b6b255ec8e914d548097 [file] [log] [blame]
package com.android.providers.downloads;
import java.io.File;
public class FsHelper {
/**
* Deletes all files under a given directory. Deliberately ignores errors, on the assumption
* that test cleanup is only supposed to be best-effort.
*
* @param directory directory to clear its contents
*/
public static void deleteContents(File directory) {
File[] files = directory.listFiles();
if (files != null) {
for (File file : files) {
if (file.isDirectory()) {
deleteContents(file);
}
file.delete();
}
}
}
}