fix: Create Keyguard downloads directory if it doesn't exist

This commit is contained in:
Artem Chepurnoy 2024-07-19 11:52:08 +03:00
parent 4bd16a82a8
commit 64c0b37558
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
2 changed files with 6 additions and 0 deletions

View File

@ -49,6 +49,9 @@ class DirsServiceAndroid(
val downloadsDir = Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
val file = downloadsDir.resolve(fileName)
// Ensure the parent directory does exist
// before writing the file.
file.parentFile?.mkdirs()
file.outputStream()
.use {
write(it)

View File

@ -47,6 +47,9 @@ class DataDirectory(
.bind()
.let(::File)
val file = downloadsDir.resolve(fileName)
// Ensure the parent directory does exist
// before writing the file.
file.parentFile?.mkdirs()
file.outputStream()
.use {
write(it)