|
|
@@ -1,5 +1,6 @@
|
|
|
package com.qy.agv.util;
|
|
|
|
|
|
+import android.content.Context;
|
|
|
import android.os.Environment;
|
|
|
|
|
|
import java.io.File;
|
|
|
@@ -22,7 +23,7 @@ public class ProjectUtils {
|
|
|
/**
|
|
|
* 项目路径
|
|
|
*/
|
|
|
- public static final String PROJECT_PATH = ROOT_DIRECTORY.getAbsolutePath() + "/"+Constant.PROJECT_NAME+"/";
|
|
|
+ public static String PROJECT_PATH = ROOT_DIRECTORY.getAbsolutePath() + "/"+Constant.PROJECT_NAME+"/";
|
|
|
|
|
|
/**
|
|
|
* 缓存
|
|
|
@@ -32,7 +33,7 @@ public class ProjectUtils {
|
|
|
/**
|
|
|
* 图片
|
|
|
*/
|
|
|
- public static final String IMG = PROJECT_PATH + "IMG/";
|
|
|
+ public static String IMG = PROJECT_PATH + "IMG/";
|
|
|
|
|
|
/**
|
|
|
* Log
|
|
|
@@ -42,7 +43,7 @@ public class ProjectUtils {
|
|
|
/**
|
|
|
* Apk下载路径
|
|
|
*/
|
|
|
- public static final String APK = PROJECT_PATH + "APK/";
|
|
|
+ public static String APK = PROJECT_PATH + "APK/";
|
|
|
|
|
|
/**
|
|
|
* 创建文件
|
|
|
@@ -75,13 +76,16 @@ public class ProjectUtils {
|
|
|
*
|
|
|
* @return If true is returned to the initial success, otherwise false
|
|
|
*/
|
|
|
- public static boolean init() {
|
|
|
+ public static boolean init(Context context) {
|
|
|
+ PROJECT_PATH = context.getExternalFilesDir(null) + "/"+Constant.PROJECT_NAME+"/";
|
|
|
boolean result = false;
|
|
|
result &= createFolder(PROJECT_PATH) != null;
|
|
|
// result &= createFolder(CACHE) != null;
|
|
|
result &= createFolder(IMG) != null;
|
|
|
// result &= createFolder(LOG) != null;
|
|
|
result &= createFolder(APK) != null;
|
|
|
+ APK = PROJECT_PATH + "APK/";
|
|
|
+ IMG = PROJECT_PATH + "IMG/";
|
|
|
return result;
|
|
|
}
|
|
|
|