From b091a87a37b0ad17639b1fe5f69b92ed56986516 Mon Sep 17 00:00:00 2001 From: Steve Johnson Date: Sun, 29 Oct 2023 23:51:00 +0800 Subject: [PATCH] fix: fix startup crash --- .../main/java/com/github/kr328/clash/MainApplication.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/kr328/clash/MainApplication.kt b/app/src/main/java/com/github/kr328/clash/MainApplication.kt index 153a2116..35226aa9 100644 --- a/app/src/main/java/com/github/kr328/clash/MainApplication.kt +++ b/app/src/main/java/com/github/kr328/clash/MainApplication.kt @@ -38,14 +38,17 @@ class MainApplication : Application() { } private fun extractGeoFiles() { - val geoipFile = File(filesDir, "clash/geoip.metadb") + val clashDir = File(filesDir, "clash") + clashDir.mkdirs(); + + val geoipFile = File(clashDir, "geoip.metadb") if(!geoipFile.exists()) { FileOutputStream(geoipFile).use { assets.open("geoip.metadb").copyTo(it); } } - val geositeFile = File(filesDir, "clash/geosite.dat") + val geositeFile = File(clashDir, "geosite.dat") if(!geositeFile.exists()) { FileOutputStream(geositeFile).use { assets.open("geosite.dat").copyTo(it);