mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-05 00:23:09 +02:00
Securily delete files
This commit is contained in:
@@ -151,6 +151,8 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.DateFormat;
|
||||
@@ -2834,6 +2836,16 @@ public class Helper {
|
||||
return files;
|
||||
}
|
||||
|
||||
static void secureDelete(File file) {
|
||||
if (file.exists()) {
|
||||
try {
|
||||
Files.delete(Paths.get(file.getAbsolutePath()));
|
||||
} catch (IOException ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static long getAvailableStorageSpace() {
|
||||
StatFs stats = new StatFs(Environment.getDataDirectory().getAbsolutePath());
|
||||
return stats.getAvailableBlocksLong() * stats.getBlockSizeLong();
|
||||
|
||||
Reference in New Issue
Block a user