mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 23:41:50 +01:00
Migrate covers to external files dir. Fix #647
This commit is contained in:
parent
05c628b33c
commit
e25ce768bb
@ -38,7 +38,7 @@ android {
|
|||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
versionCode 18
|
versionCode 19
|
||||||
versionName "0.4.2"
|
versionName "0.4.2"
|
||||||
|
|
||||||
buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
|
buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
|
||||||
|
@ -20,7 +20,7 @@ class CoverCache(private val context: Context) {
|
|||||||
/**
|
/**
|
||||||
* Cache directory used for cache management.
|
* 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.
|
* Returns the cover from cache.
|
||||||
|
@ -39,6 +39,18 @@ class ChangelogDialogFragment : DialogFragment() {
|
|||||||
// Delete internal chapter cache dir.
|
// Delete internal chapter cache dir.
|
||||||
File(context.cacheDir, "chapter_disk_cache").deleteRecursively()
|
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 New Issue
Block a user