show a more specific error message when creating .nomedia file fails

This commit is contained in:
tibbi 2017-10-19 19:18:36 +02:00
parent 2dbbc2bbdb
commit 1d56b2ac8b

View file

@ -227,16 +227,18 @@ fun SimpleActivity.addNoMedia(path: String, callback: () -> Unit) {
val fileDocument = getFileDocument(path)
if (fileDocument?.exists() == true && fileDocument.isDirectory) {
fileDocument.createFile("", NOMEDIA)
} else
} else {
toast(R.string.unknown_error_occurred)
}
}
} else {
try {
file.createNewFile()
} catch (e: Exception) {
toast(R.string.unknown_error_occurred)
showErrorToast(e)
}
}
scanFile(file) {
callback()
}