Skip to content

Commit

Permalink
fix: ensure parent directory exists before writing to file
Browse files Browse the repository at this point in the history
  • Loading branch information
wangl-cc committed Sep 9, 2024
1 parent 10bf579 commit bd5c132
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions maa-cli/src/run/preset/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ mod tests {
object,
};

use maa_dirs::Ensure;

impl MAAValue {
/// Merge another value into this default value.
///
Expand Down Expand Up @@ -158,6 +160,7 @@ mod tests {
assert_eq!(task_config[0].params, object!());

let default = default_file(TaskType::Custom).with_extension("toml");
default.parent().unwrap().ensure().unwrap();
let mut file = std::fs::File::create(&default).unwrap();
use std::io::Write;
writeln!(file, "foo = 42").unwrap();
Expand Down

0 comments on commit bd5c132

Please sign in to comment.