mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 23:07:48 +01:00
Migrate covers to external files dir. Fix #647
This commit is contained in:
parent
05c628b33c
commit
e25ce768bb
3 changed files with 14 additions and 2 deletions
|
@ -38,7 +38,7 @@ android {
|
|||
minSdkVersion 16
|
||||
targetSdkVersion 25
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
versionCode 18
|
||||
versionCode 19
|
||||
versionName "0.4.2"
|
||||
|
||||
buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
|
||||
|
|
|
@ -20,7 +20,7 @@ class CoverCache(private val context: Context) {
|
|||
/**
|
||||
* Cache directory used for cache management.
|
||||
*/
|
||||
private val cacheDir: File = File(context.externalCacheDir, "cover_disk_cache")
|
||||
private val cacheDir = context.getExternalFilesDir("covers")
|
||||
|
||||
/**
|
||||
* Returns the cover from cache.
|
||||
|
|
|
@ -39,6 +39,18 @@ class ChangelogDialogFragment : DialogFragment() {
|
|||
// Delete internal chapter cache dir.
|
||||
File(context.cacheDir, "chapter_disk_cache").deleteRecursively()
|
||||
}
|
||||
if (oldVersion < 19) {
|
||||
// Move covers to external files dir.
|
||||
val oldDir = File(context.externalCacheDir, "cover_disk_cache")
|
||||
if (oldDir.exists()) {
|
||||
val destDir = context.getExternalFilesDir("covers")
|
||||
if (destDir != null) {
|
||||
oldDir.listFiles().forEach {
|
||||
it.renameTo(File(destDir, it.name))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue