From 44b148f2a458d3c130095169c8502d4aaa88a238 Mon Sep 17 00:00:00 2001 From: ffauzan <32434534+ffauzan@users.noreply.github.com> Date: Mon, 18 Jul 2022 22:03:01 +0700 Subject: [PATCH] Fix toggle encryption Open the config file in write mode so the toggle encryption button is actually working --- src-tauri/src/file_helpers.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/file_helpers.rs b/src-tauri/src/file_helpers.rs index bcfeaee..68c4878 100644 --- a/src-tauri/src/file_helpers.rs +++ b/src-tauri/src/file_helpers.rs @@ -138,7 +138,7 @@ pub fn write_file(path: String, contents: String) { let path_buf = std::path::PathBuf::from(&path); // Create file if it exists, otherwise just open and rewrite - let mut file = match fs::File::open(&path_buf) { + let mut file = match fs::File::options().write(true).truncate(true).open(&path_buf) { Ok(file) => file, Err(e) => { println!("Failed to open file: {}", e); @@ -162,4 +162,4 @@ pub fn write_file(path: String, contents: String) { return; } } -} \ No newline at end of file +}