FileUtils.java
988 Bytes
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
package com.polysoft.nafmii.utils;
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 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();
}
}