From 487cbdf7e8c5382d21743d365819d8e76c825d65 Mon Sep 17 00:00:00 2001 From: LordPatate <35635468+LordPatate@users.noreply.github.com> Date: Thu, 15 Aug 2024 11:57:17 +0200 Subject: [PATCH 1/2] Fix FileSystem::write docstring (#150) It does not make sense to create a file when it exists. I guess it must be the opposite, create it when it does *not* exist. --- crates/filesystem/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/filesystem/src/lib.rs b/crates/filesystem/src/lib.rs index 410cdb7c..f5a11128 100644 --- a/crates/filesystem/src/lib.rs +++ b/crates/filesystem/src/lib.rs @@ -247,7 +247,8 @@ pub trait FileSystem: Send + Sync { } /// Corresponds to [`std::fs::write()`]. - /// Will open a file at the path, create it if it exists (and truncate it) and then write the provided bytes. + /// Will open a file at the path, create it if it does not exist (and truncate it) + /// and then write the provided bytes. fn write(&self, path: impl AsRef, data: impl AsRef<[u8]>) -> Result<()> { use std::io::Write; From 0cb37c687ea2d48cb2151cc2bc38e3669a8f7f42 Mon Sep 17 00:00:00 2001 From: LordPatate <35635468+LordPatate@users.noreply.github.com> Date: Thu, 15 Aug 2024 11:58:24 +0200 Subject: [PATCH 2/2] Fix data save commands backtrace (#151) --- crates/core/src/data_cache.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/core/src/data_cache.rs b/crates/core/src/data_cache.rs index 3eb54e03..9f15b092 100644 --- a/crates/core/src/data_cache.rs +++ b/crates/core/src/data_cache.rs @@ -330,7 +330,7 @@ impl Data { .wrap_err("While serializing .luminol/commands")?; filesystem .write(".luminol/commands", command_db) - .wrap_err("While writing .luminol/config")?; + .wrap_err("While writing .luminol/commands")?; // even though Ini uses fmt::write internally, it provides no easy way to write to a string. // so we need to open a file instead