Skip to content

Commit

Permalink
refactor: move snippet directory to current dir (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
hougesen authored Mar 23, 2024
1 parent 602bc74 commit 8e01e4e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/formatters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ pub mod zigfmt;

#[inline]
pub fn setup_snippet(code: &str, file_ext: &str) -> std::io::Result<NamedTempFile> {
let _ = std::fs::create_dir_all(".mdsf-cache");

let mut f = tempfile::Builder::new()
.rand_bytes(12)
.suffix(file_ext)
Expand All @@ -74,7 +76,7 @@ pub fn setup_snippet(code: &str, file_ext: &str) -> std::io::Result<NamedTempFil
"mdsf"
},
)
.tempfile()?;
.tempfile_in(".mdsf-cache")?;

f.write_all(code.as_bytes())?;
f.flush()?;
Expand Down

0 comments on commit 8e01e4e

Please sign in to comment.