|
@@ -87,7 +87,7 @@ object FoodDataProvider {
|
|
|
try {
|
|
|
var targetZipFile = ZIP_PATH
|
|
|
val start = System.currentTimeMillis()
|
|
|
- ZipUtils.unzipFile(targetZipFile, TARGET_DST_PARENT)
|
|
|
+ ZipUtils.unzipFile(targetZipFile, RES_DST_PATH)
|
|
|
Log.d(
|
|
|
"FoodDataProvider", "cost time:${System.currentTimeMillis() - start}"
|
|
|
)
|
|
@@ -96,7 +96,7 @@ object FoodDataProvider {
|
|
|
// 1s后再重试
|
|
|
Thread.sleep(1000)
|
|
|
FileUtils.delete(RES_DST_PATH)
|
|
|
- ZipUtils.unzipFile(targetZipFile, TARGET_DST_PARENT)
|
|
|
+ ZipUtils.unzipFile(targetZipFile, RES_DST_PATH)
|
|
|
}
|
|
|
validateDatabaseFile()
|
|
|
} catch (ex: Exception) {
|
|
@@ -140,16 +140,16 @@ object FoodDataProvider {
|
|
|
return resFile.absolutePath
|
|
|
}
|
|
|
return if (relativePath.endsWith("png")) {
|
|
|
- "$TARGET_DST_PARENT/${relativePath.replace("png", "jpg")}"
|
|
|
+ "$RES_DST_PATH/${relativePath.replace("png", "jpg")}"
|
|
|
} else {
|
|
|
- "$TARGET_DST_PARENT/${relativePath.replace("jpg", "png")}"
|
|
|
+ "$RES_DST_PATH/${relativePath.replace("jpg", "png")}"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**根据菜品number删除对应资源文件*/
|
|
|
fun deleteRecipeResource(recipeNum: String) {
|
|
|
val relPath = "_data/recipe/${recipeNum}"
|
|
|
- val dir = File(TARGET_DST_PARENT, relPath)
|
|
|
+ val dir = File(RES_DST_PATH, relPath)
|
|
|
if (dir.exists()) {
|
|
|
try {
|
|
|
FileUtils.delete(dir)
|
|
@@ -161,10 +161,10 @@ object FoodDataProvider {
|
|
|
|
|
|
/**删除菜品资源包*/
|
|
|
fun deleteAll() {
|
|
|
- if (TARGET_DST_PARENT.exists()) {
|
|
|
+ if (RES_DST_PATH.exists()) {
|
|
|
try {
|
|
|
FileUtils.delete(SUCCESS_FLAG)
|
|
|
- FileUtils.delete(TARGET_DST_PARENT)
|
|
|
+ FileUtils.delete(RES_DST_PATH)
|
|
|
} catch (ex: Exception) {
|
|
|
ex.printStackTrace()
|
|
|
}
|
|
@@ -174,7 +174,7 @@ object FoodDataProvider {
|
|
|
/**根据菜品number获取configJson文件*/
|
|
|
fun getResourceConfigJsonPath(recipeNum: String): File {
|
|
|
val relPath = "_data/recipe/${recipeNum}/data.json"
|
|
|
- return File(TARGET_DST_PARENT, relPath)
|
|
|
+ return File(RES_DST_PATH, relPath)
|
|
|
}
|
|
|
|
|
|
/**判断菜品number对应的configJson文件是否存在*/
|
|
@@ -196,12 +196,12 @@ object FoodDataProvider {
|
|
|
return relativePath
|
|
|
}
|
|
|
// preparedLock.await()
|
|
|
- return "${TARGET_DST_PARENT.absolutePath}/$relativePath"
|
|
|
+ return "${RES_DST_PATH.absolutePath}/$relativePath"
|
|
|
}
|
|
|
|
|
|
private fun getResource(relativePath: String): File {
|
|
|
preparedLock.await()
|
|
|
- return File(TARGET_DST_PARENT, relativePath)
|
|
|
+ return File(RES_DST_PATH, relativePath)
|
|
|
}
|
|
|
|
|
|
private fun validateDatabaseFile() {
|