Skip to content

Commit 8f4d027

Browse files
tumuyanBambooin
authored andcommitted
fix: missing default.custom.yaml
1 parent 7a9a691 commit 8f4d027

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

app/src/main/java/com/osfans/trime/data/Config.java

+3-16
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import android.graphics.drawable.Drawable;
3131
import android.graphics.drawable.GradientDrawable;
3232
import android.graphics.drawable.NinePatchDrawable;
33-
import android.os.SystemClock;
3433
import android.util.TypedValue;
3534
import androidx.annotation.NonNull;
3635
import androidx.annotation.Nullable;
@@ -182,25 +181,13 @@ public void prepareRime(Context context) {
182181
boolean isOverwrite = AppVersionUtils.INSTANCE.isDifferentVersion(appPrefs);
183182
String defaultFile = "trime.yaml";
184183
Timber.d(methodName + "copy");
185-
if (isOverwrite) {
186-
copyFileOrDir("", true);
187-
} else if (isExist) {
188-
String path = new File("", defaultFile).getPath();
189-
copyFileOrDir(path, false);
190-
} else {
191-
copyFileOrDir("", false);
192-
}
193-
Timber.d(methodName + "copy2");
194-
while (!new File(sharedDataDir, defaultFile).exists()) {
195-
SystemClock.sleep(100);
196-
copyFileOrDir("", isOverwrite);
197-
}
184+
copyFileOrDir("", isOverwrite);
198185
// 缺失导致获取方案列表为空
199186
Timber.d(methodName + "copy default.custom.yaml");
200187
final String defaultCustom = "default.custom.yaml";
201-
if (!new File(sharedDataDir, defaultCustom).exists()) {
188+
if (!new File(userDataDir, defaultCustom).exists()) {
202189
try {
203-
new File(sharedDataDir, defaultCustom).createNewFile();
190+
new File(userDataDir, defaultCustom).createNewFile();
204191
} catch (IOException e) {
205192
e.printStackTrace();
206193
}

0 commit comments

Comments
 (0)