fix: Create Keyguard downloads directory if it doesn't exist
This commit is contained in:
parent
4bd16a82a8
commit
64c0b37558
|
@ -49,6 +49,9 @@ class DirsServiceAndroid(
|
||||||
val downloadsDir = Environment
|
val downloadsDir = Environment
|
||||||
.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
|
.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
|
||||||
val file = downloadsDir.resolve(fileName)
|
val file = downloadsDir.resolve(fileName)
|
||||||
|
// Ensure the parent directory does exist
|
||||||
|
// before writing the file.
|
||||||
|
file.parentFile?.mkdirs()
|
||||||
file.outputStream()
|
file.outputStream()
|
||||||
.use {
|
.use {
|
||||||
write(it)
|
write(it)
|
||||||
|
|
|
@ -47,6 +47,9 @@ class DataDirectory(
|
||||||
.bind()
|
.bind()
|
||||||
.let(::File)
|
.let(::File)
|
||||||
val file = downloadsDir.resolve(fileName)
|
val file = downloadsDir.resolve(fileName)
|
||||||
|
// Ensure the parent directory does exist
|
||||||
|
// before writing the file.
|
||||||
|
file.parentFile?.mkdirs()
|
||||||
file.outputStream()
|
file.outputStream()
|
||||||
.use {
|
.use {
|
||||||
write(it)
|
write(it)
|
||||||
|
|
Loading…
Reference in New Issue