diff --git a/app/src/main/java/com/zane/smapiinstaller/logic/ApkPatcher.java b/app/src/main/java/com/zane/smapiinstaller/logic/ApkPatcher.java
index 6dfb6f7..7e7f84d 100644
--- a/app/src/main/java/com/zane/smapiinstaller/logic/ApkPatcher.java
+++ b/app/src/main/java/com/zane/smapiinstaller/logic/ApkPatcher.java
@@ -125,6 +125,16 @@ public class ApkPatcher {
});
return distFile.getAbsolutePath();
} else if (advancedStage == 1) {
+ File contentFolder = new File(externalFilesDir.getAbsolutePath() + "/StardewValley/Content");
+ if(contentFolder.exists()) {
+ if(!contentFolder.isDirectory()) {
+ errorMessage.set(context.getString(R.string.error_directory_exists_with_same_filename, contentFolder.getAbsolutePath()));
+ return null;
+ }
+ }
+ else {
+ extract(0);
+ }
ZipUtils.removeEntries(sourceDir, "assets/Content", distFile.getAbsolutePath(), (progress) -> emitProgress((int) (progress * 0.05)));
} else {
Files.copy(apkFile, distFile);
@@ -195,7 +205,8 @@ public class ApkPatcher {
if (StringUtils.equals(crc, entry.getPatchCrc())) {
bytes = FileUtils.patchFile(originBytes, bytes);
if (bytes == null) {
- errorMessage.set(StringUtils.stripToEmpty(errorMessage.get()) + "\nPatch " + entry.getTargetPath() + " failed");
+ String errorMsg = context.getString(R.string.error_patch_crc_incorrect, entry.getTargetPath(), crc);
+ errorMessage.set(StringUtils.stripToEmpty(errorMessage.get()) + "\n" + errorMsg);
return null;
}
}
@@ -203,7 +214,8 @@ public class ApkPatcher {
bytes = originBytes;
}
else {
- errorMessage.set(StringUtils.stripToEmpty(errorMessage.get()) + "\nPatch " + entry.getTargetPath() + " failed: CRC (" + crc + ")");
+ String errorMsg = context.getString(R.string.error_patch_crc_incorrect, entry.getTargetPath(), crc);
+ errorMessage.set(StringUtils.stripToEmpty(errorMessage.get()) + "\n" + errorMsg);
return null;
}
}
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index 4426cad..fb66564 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -78,4 +78,6 @@
隱私權條款
高級安裝模式
初始化
+ %1$s不是一個文件夾, 請手動刪除該文件
+ 增量更新%1$s失敗: CRC (%2$s))
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index e40bad6..afdbd1b 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -78,4 +78,6 @@
隐私权政策
高级安装模式
初始化
+ %1$s不是一个文件夹, 请手动删除该文件
+ 增量更新%1$s失败: CRC (%2$s))
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index db653fd..37c7e7d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -82,4 +82,6 @@
Privacy Policy
Advanced Patch Mode
Initial
+ %1$s is not a directory, please delete it manually.
+ Patch %1$s failed: CRC (%2$s))