musikr: fix cover storage dir check
This commit is contained in:
parent
b8733a180c
commit
2f5b78dd84
1 changed files with 3 additions and 1 deletions
|
@ -39,7 +39,9 @@ interface CoverStorage {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
suspend fun at(dir: File): CoverStorage {
|
suspend fun at(dir: File): CoverStorage {
|
||||||
withContext(Dispatchers.IO) { check(dir.exists() && dir.isDirectory) }
|
withContext(Dispatchers.IO) {
|
||||||
|
if (dir.exists()) check(dir.isDirectory) { "Not a directory" } else check(dir.mkdirs()) { "Cannot create directory" }
|
||||||
|
}
|
||||||
return CoverStorageImpl(dir)
|
return CoverStorageImpl(dir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue