Avoid attempts to renaming download dirs if name hasn't actually changed
Maybe fixes #9503 (cherry picked from commit fb38d307750a849e7c941c164a3c223d69f2cd14)
This commit is contained in:
parent
f37b661307
commit
ac9048db46
@ -358,9 +358,11 @@ class DownloadManager(
|
|||||||
val oldFolder = provider.findSourceDir(oldSource) ?: return
|
val oldFolder = provider.findSourceDir(oldSource) ?: return
|
||||||
val newName = provider.getSourceDirName(newSource)
|
val newName = provider.getSourceDirName(newSource)
|
||||||
|
|
||||||
|
if (oldFolder.name == newName) return
|
||||||
|
|
||||||
val capitalizationChanged = oldFolder.name.equals(newName, ignoreCase = true)
|
val capitalizationChanged = oldFolder.name.equals(newName, ignoreCase = true)
|
||||||
if (capitalizationChanged) {
|
if (capitalizationChanged) {
|
||||||
val tempName = newName + "_tmp"
|
val tempName = newName + Downloader.TMP_DIR_SUFFIX
|
||||||
if (oldFolder.renameTo(tempName).not()) {
|
if (oldFolder.renameTo(tempName).not()) {
|
||||||
logcat(LogPriority.ERROR) { "Failed to rename source download folder: ${oldFolder.name}" }
|
logcat(LogPriority.ERROR) { "Failed to rename source download folder: ${oldFolder.name}" }
|
||||||
return
|
return
|
||||||
@ -394,6 +396,8 @@ class DownloadManager(
|
|||||||
newName += ".cbz"
|
newName += ".cbz"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oldDownload.name == newName) return
|
||||||
|
|
||||||
if (oldDownload.renameTo(newName)) {
|
if (oldDownload.renameTo(newName)) {
|
||||||
cache.removeChapter(oldChapter, manga)
|
cache.removeChapter(oldChapter, manga)
|
||||||
cache.addChapter(newName, mangaDir, manga)
|
cache.addChapter(newName, mangaDir, manga)
|
||||||
|
@ -209,7 +209,7 @@ class AndroidSourceManager(
|
|||||||
registerStubSource(it)
|
registerStubSource(it)
|
||||||
return it
|
return it
|
||||||
}
|
}
|
||||||
return StubSource(id, "", "")
|
return StubSource(id = id, lang = "", name = "")
|
||||||
}
|
}
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
|
@ -5,14 +5,14 @@ import tachiyomi.domain.source.model.StubSource
|
|||||||
|
|
||||||
val sourceMapper: (eu.kanade.tachiyomi.source.Source) -> Source = { source ->
|
val sourceMapper: (eu.kanade.tachiyomi.source.Source) -> Source = { source ->
|
||||||
Source(
|
Source(
|
||||||
source.id,
|
id = source.id,
|
||||||
source.lang,
|
lang = source.lang,
|
||||||
source.name,
|
name = source.name,
|
||||||
supportsLatest = false,
|
supportsLatest = false,
|
||||||
isStub = false,
|
isStub = false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val sourceDataMapper: (Long, String, String) -> StubSource = { id, lang, name ->
|
val sourceDataMapper: (Long, String, String) -> StubSource = { id, lang, name ->
|
||||||
StubSource(id, lang, name)
|
StubSource(id = id, lang = lang, name = name)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user