musikr: offload storage dir creation to client
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user