FileUtils.java
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.polysoft.nafmii.utils;
import android.os.Environment;
import java.io.File;
public class FileUtils {
public static File getIndex() {
return new File(getDistDir(), "index.html");
}
public static File getDistDir() {
File dist = new File(getRootDir(), "dist");
if (!dist.exists()) {
dist.mkdirs();
}
return dist;
}
public static File getDownloadDir() {
File download = new File(getRootDir(), "download");
if (!download.exists()) {
download.mkdirs();
}
return download;
}
public static File getSysDownLoadDir() {
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
// return CtxUtils.getApplication().getExternalFilesDir();
}
public static File getRootDir() {
return CtxUtils.getApplication().getFilesDir();
}
public static File getRootCacheDir() {
return CtxUtils.getApplication().getCacheDir();
}
public static void deletes(File file) {
if (file.isDirectory()) {
for (File f : file.listFiles()) {
deletes(f);
}
}
file.delete();
}
}