aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorpacien2020-09-16 07:06:19 +0200
committerpacien2020-09-16 07:06:19 +0200
commit1f834b0ef8bcade30a1ec59b372a50a815fb566d (patch)
treeb0771613ca9c7df3e9a4f13260b4644de5492bcc /app/src/main
parent2ca13684d9ae0a8f515a68d135d5b160a36f0bff (diff)
downloadtincapp-1f834b0ef8bcade30a1ec59b372a50a815fb566d.tar.gz
context/paths: add fallback to internal cache dir
The external cache directory used to store the application's log files may not be available on all devices, in particular on Android >11. GitHub: closes #98
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/org/pacien/tincapp/context/AppPaths.kt2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/context/AppPaths.kt b/app/src/main/java/org/pacien/tincapp/context/AppPaths.kt
index 2394586..bd8316a 100644
--- a/app/src/main/java/org/pacien/tincapp/context/AppPaths.kt
+++ b/app/src/main/java/org/pacien/tincapp/context/AppPaths.kt
@@ -50,7 +50,7 @@ object AppPaths {
50 Environment.getExternalStorageState().let { it == Environment.MEDIA_MOUNTED && it != Environment.MEDIA_MOUNTED_READ_ONLY } 50 Environment.getExternalStorageState().let { it == Environment.MEDIA_MOUNTED && it != Environment.MEDIA_MOUNTED_READ_ONLY }
51 51
52 fun internalCacheDir() = context.cacheDir!! 52 fun internalCacheDir() = context.cacheDir!!
53 fun cacheDir() = context.externalCacheDir!! 53 fun cacheDir() = context.externalCacheDir ?: internalCacheDir()
54 fun confDir() = context.getExternalFilesDir(null)!! 54 fun confDir() = context.getExternalFilesDir(null)!!
55 private fun binDir() = File(context.applicationInfo.nativeLibraryDir) 55 private fun binDir() = File(context.applicationInfo.nativeLibraryDir)
56 56