musikr: offload storage dir creation to client
This commit is contained in:
parent
e7454e636b
commit
132b689b0c
2 changed files with 2 additions and 3 deletions
|
@ -70,4 +70,4 @@ class SettingCoversImpl @Inject constructor(private val imageSettings: ImageSett
|
|||
}
|
||||
}
|
||||
|
||||
private fun Context.coversDir() = filesDir.resolve("covers")
|
||||
private fun Context.coversDir() = filesDir.resolve("covers").apply { mkdirs() }
|
||||
|
|
|
@ -82,8 +82,7 @@ interface CoverStorage {
|
|||
*/
|
||||
suspend fun at(dir: File): CoverStorage {
|
||||
withContext(Dispatchers.IO) {
|
||||
if (dir.exists()) check(dir.isDirectory) { "Not a directory" }
|
||||
else check(dir.mkdirs()) { "Cannot create directory" }
|
||||
check(dir.exists() && dir.isDirectory) { "Not a existent directory" }
|
||||
}
|
||||
return FSCoverStorage(dir)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue