show a more specific error message when creating .nomedia file fails
This commit is contained in:
parent
2dbbc2bbdb
commit
1d56b2ac8b
1 changed files with 4 additions and 2 deletions
|
@ -227,16 +227,18 @@ fun SimpleActivity.addNoMedia(path: String, callback: () -> Unit) {
|
||||||
val fileDocument = getFileDocument(path)
|
val fileDocument = getFileDocument(path)
|
||||||
if (fileDocument?.exists() == true && fileDocument.isDirectory) {
|
if (fileDocument?.exists() == true && fileDocument.isDirectory) {
|
||||||
fileDocument.createFile("", NOMEDIA)
|
fileDocument.createFile("", NOMEDIA)
|
||||||
} else
|
} else {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(R.string.unknown_error_occurred)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
file.createNewFile()
|
file.createNewFile()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
toast(R.string.unknown_error_occurred)
|
showErrorToast(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scanFile(file) {
|
scanFile(file) {
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue