Skip to content

Commit

Permalink
Fixes #335
Browse files Browse the repository at this point in the history
  • Loading branch information
cognition9144 committed Mar 22, 2020
1 parent 8fad97b commit b5dc046
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions app/src/main/java/com/osfans/trime/Config.java
Expand Up @@ -101,16 +101,16 @@ private void prepareRime(Context context) {
boolean isOverwrite = Function.isDiffVer(context);
String defaultFile = "trime.yaml";
if (isOverwrite) {
copyFileOrDir(context, RIME, true);
copyFileOrDir(context, "", true);
} else if (isExist) {
String path = new File(RIME, defaultFile).getPath();
String path = new File("", defaultFile).getPath();
copyFileOrDir(context, path, false);
} else {
copyFileOrDir(context, RIME, false);
copyFileOrDir(context, "", false);
}
while (!new File(getSharedDataDir(), defaultFile).exists()) {
SystemClock.sleep(3000);
copyFileOrDir(context, RIME, isOverwrite);
copyFileOrDir(context, "", isOverwrite);
}
Rime.get(!isExist); //覆蓋時不強制部署
}
Expand Down Expand Up @@ -177,7 +177,7 @@ public boolean copyFileOrDir(Context context, String path, boolean overwrite) {
if (assets.length == 0) {
copyFile(context, path, overwrite);
} else {
File dir = new File(getSharedDataDir(), path.length() >= 5 ? path.substring(5) : "");
File dir = new File(getSharedDataDir(), path);
if (!dir.exists()) dir.mkdir();
for (int i = 0; i < assets.length; ++i) {
String assetPath = new File(path, assets[i]).getPath();
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/osfans/trime/ResetDialog.java
Expand Up @@ -41,7 +41,7 @@ private void select() {
int n = items.length;
for (int i = 0; i < n; i++) {
if (checked[i]) {
ret = Config.get(context).copyFileOrDir(context, "rime/" + items[i], true);
ret = Config.get(context).copyFileOrDir(context, items[i], true);
}
}
Toast.makeText(
Expand Down

0 comments on commit b5dc046

Please sign in to comment.