Always save pages/covers in subfolders

Ensures that pages and covers are grouped together.
This commit is contained in:
arkon
2023-10-08 17:04:02 -04:00
parent 7ed99fbbd6
commit 8568d5d6c3
6 changed files with 6 additions and 24 deletions

View File

@@ -166,19 +166,12 @@ sealed class Image(
}
sealed interface Location {
data class Pictures private constructor(val relativePath: String) : Location {
companion object {
fun create(relativePath: String = ""): Pictures {
return Pictures(relativePath)
}
}
}
data class Pictures(val relativePath: String) : Location
data object Cache : Location
fun directory(context: Context): File {
return when (this) {
Cache -> context.cacheImageDir
is Pictures -> {
val file = File(
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
@@ -192,6 +185,7 @@ sealed interface Location {
}
file
}
Cache -> context.cacheImageDir
}
}
}