fix: fix startup crash

This commit is contained in:
Steve Johnson 2023-10-29 23:51:00 +08:00
parent ecf03507e6
commit b091a87a37

View File

@ -38,14 +38,17 @@ class MainApplication : Application() {
} }
private fun extractGeoFiles() { 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()) { if(!geoipFile.exists()) {
FileOutputStream(geoipFile).use { FileOutputStream(geoipFile).use {
assets.open("geoip.metadb").copyTo(it); assets.open("geoip.metadb").copyTo(it);
} }
} }
val geositeFile = File(filesDir, "clash/geosite.dat") val geositeFile = File(clashDir, "geosite.dat")
if(!geositeFile.exists()) { if(!geositeFile.exists()) {
FileOutputStream(geositeFile).use { FileOutputStream(geositeFile).use {
assets.open("geosite.dat").copyTo(it); assets.open("geosite.dat").copyTo(it);