From bcb045a70a4427243ab6631c2cce45906a20ca92 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Sun, 10 Nov 2019 10:39:32 -0600 Subject: [PATCH] Fix saving data to override any existing data in a file --- .../com/wbrawner/simplemarkdown/viewmodel/MarkdownViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/viewmodel/MarkdownViewModel.kt b/app/src/main/java/com/wbrawner/simplemarkdown/viewmodel/MarkdownViewModel.kt index f74f6f8..39d9887 100644 --- a/app/src/main/java/com/wbrawner/simplemarkdown/viewmodel/MarkdownViewModel.kt +++ b/app/src/main/java/com/wbrawner/simplemarkdown/viewmodel/MarkdownViewModel.kt @@ -49,7 +49,7 @@ class MarkdownViewModel : ViewModel() { return withContext(Dispatchers.IO) { try { val fileName = uri.getName(context) - val outputStream = context.contentResolver.openOutputStream(uri) + val outputStream = context.contentResolver.openOutputStream(uri, "rwt") ?: return@withContext false outputStream.writer().use { it.write(markdownUpdates.value ?: "")