Provide more human readable error when downloading to invalid directory (#2462)
(cherry picked from commit 13a2d3dfdd
)
This commit is contained in:
parent
9bb3195bca
commit
c40e4f6c5a
3 changed files with 10 additions and 4 deletions
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.data.download
|
|||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import com.hippo.unifile.UniFile
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
|
@ -46,9 +47,13 @@ class DownloadProvider(private val context: Context) {
|
|||
* @param source the source of the manga.
|
||||
*/
|
||||
internal fun getMangaDir(manga: Manga, source: Source): UniFile {
|
||||
try {
|
||||
return downloadsDir
|
||||
.createDirectory(getSourceDirName(source))
|
||||
.createDirectory(getMangaDirName(manga))
|
||||
} catch (e: NullPointerException) {
|
||||
throw Exception(context.getString(R.string.invalid_download_dir))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -102,7 +102,7 @@ class Downloader(
|
|||
pending.forEach { if (it.status != Download.QUEUE) it.status = Download.QUEUE }
|
||||
|
||||
downloadsRelay.call(pending)
|
||||
return !pending.isEmpty()
|
||||
return pending.isNotEmpty()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -393,6 +393,7 @@
|
|||
<string name="download_all">Download all</string>
|
||||
<string name="download_unread">Download unread</string>
|
||||
<string name="confirm_delete_chapters">Are you sure you want to delete selected chapters?</string>
|
||||
<string name="invalid_download_dir">Invalid download directory</string>
|
||||
|
||||
<!-- Tracking Screen -->
|
||||
<string name="manga_tracking_tab">Tracking</string>
|
||||
|
|
Reference in a new issue