mirror of https://github.com/NekoX-Dev/NekoX.git
Use internal directory for cache in android R by default ( #284 )
This commit is contained in:
parent
08b97917a7
commit
0954be4d5d
|
@ -1,6 +1,7 @@
|
|||
package tw.nekomimi.nekogram.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.os.storage.StorageManager
|
||||
import org.telegram.messenger.ApplicationLoader
|
||||
|
@ -44,7 +45,12 @@ object EnvUtil {
|
|||
|
||||
if (NekoConfig.cachePath == null) {
|
||||
|
||||
NekoConfig.setCachePath(ApplicationLoader.applicationContext.getExternalFilesDir(null)!!.path)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
// https://github.com/NekoX-Dev/NekoX/issues/284
|
||||
NekoConfig.setCachePath(File(ApplicationLoader.getDataDirFixed(), "cache/media").path)
|
||||
} else {
|
||||
NekoConfig.setCachePath(ApplicationLoader.applicationContext.getExternalFilesDir(null)!!.path)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue