mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-21 05:41:52 +01:00
Avoid attempts to renaming download dirs if name hasn't actually changed
Maybe fixes #9503
This commit is contained in:
parent
a3a9c8ac8e
commit
fb38d30775
@ -303,9 +303,11 @@ class DownloadManager(
|
||||
val oldFolder = provider.findSourceDir(oldSource) ?: return
|
||||
val newName = provider.getSourceDirName(newSource)
|
||||
|
||||
if (oldFolder.name == newName) return
|
||||
|
||||
val capitalizationChanged = oldFolder.name.equals(newName, ignoreCase = true)
|
||||
if (capitalizationChanged) {
|
||||
val tempName = newName + "_tmp"
|
||||
val tempName = newName + Downloader.TMP_DIR_SUFFIX
|
||||
if (oldFolder.renameTo(tempName).not()) {
|
||||
logcat(LogPriority.ERROR) { "Failed to rename source download folder: ${oldFolder.name}" }
|
||||
return
|
||||
@ -339,6 +341,8 @@ class DownloadManager(
|
||||
newName += ".cbz"
|
||||
}
|
||||
|
||||
if (oldDownload.name == newName) return
|
||||
|
||||
if (oldDownload.renameTo(newName)) {
|
||||
cache.removeChapter(oldChapter, manga)
|
||||
cache.addChapter(newName, mangaDir, manga)
|
||||
|
@ -110,6 +110,6 @@ class AndroidSourceManager(
|
||||
registerStubSource(it)
|
||||
return it
|
||||
}
|
||||
return StubSource(id, "", "")
|
||||
return StubSource(id = id, lang = "", name = "")
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,14 @@ import tachiyomi.domain.source.model.StubSource
|
||||
|
||||
val sourceMapper: (eu.kanade.tachiyomi.source.Source) -> Source = { source ->
|
||||
Source(
|
||||
source.id,
|
||||
source.lang,
|
||||
source.name,
|
||||
id = source.id,
|
||||
lang = source.lang,
|
||||
name = source.name,
|
||||
supportsLatest = false,
|
||||
isStub = false,
|
||||
)
|
||||
}
|
||||
|
||||
val sourceDataMapper: (Long, String, String) -> StubSource = { id, lang, name ->
|
||||
StubSource(id, lang, name)
|
||||
StubSource(id = id, lang = lang, name = name)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user