WebVersionUtils.java
952 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
package com.polysoft.nafmii.utils;
import com.whaty.nafmii.BuildConfig;
import java.io.File;
public class WebVersionUtils {
public static String getVersion() {
return SpUtils.getString(SpUtils.KEY_H5_VERSION, BuildConfig.H5_VERSION);
}
public static void setVersion(String name) {
SpUtils.putString(SpUtils.KEY_H5_VERSION, name);
}
public static File getIndex() {
return new File(getDistDir(), "index.html");
}
public static File getDistDir() {
return getDistDir(getVersion());
}
public static File getDistDir(String version) {
File verisonDir = new File(FileUtils.getHotDir(), version);
File dist = new File(verisonDir, "dist");
if (!dist.exists()) {
dist.mkdirs();
}
return dist;
}
public static File getDistZip(String version) {
return new File(getDistDir(version).getParentFile(), "dist.zip");
}
}