mirror of
https://github.com/mfontanini/presenterm.git
synced 2025-05-07 16:33:01 +00:00
chore: use ".presenterm" as prefix for tmp files (#306)
This commit is contained in:
commit
e2000e6a9c
@ -21,7 +21,6 @@ use std::{
|
|||||||
sync::{Arc, Condvar, Mutex},
|
sync::{Arc, Condvar, Mutex},
|
||||||
thread,
|
thread,
|
||||||
};
|
};
|
||||||
use tempfile::tempdir_in;
|
|
||||||
|
|
||||||
const DEFAULT_HORIZONTAL_MARGIN: u16 = 5;
|
const DEFAULT_HORIZONTAL_MARGIN: u16 = 5;
|
||||||
const DEFAULT_VERTICAL_MARGIN: u16 = 7;
|
const DEFAULT_VERTICAL_MARGIN: u16 = 7;
|
||||||
@ -198,7 +197,7 @@ impl Worker {
|
|||||||
if let Some(image) = self.state.lock().unwrap().cache.get(&snippet).cloned() {
|
if let Some(image) = self.state.lock().unwrap().cache.get(&snippet).cloned() {
|
||||||
return Ok(image);
|
return Ok(image);
|
||||||
}
|
}
|
||||||
let workdir = tempdir_in(&self.shared.root_dir)?;
|
let workdir = tempfile::Builder::default().prefix(".presenterm").tempdir()?;
|
||||||
let output_path = workdir.path().join("output.png");
|
let output_path = workdir.path().join("output.png");
|
||||||
let input_path = workdir.path().join("input.mmd");
|
let input_path = workdir.path().join("input.mmd");
|
||||||
fs::write(&input_path, input)?;
|
fs::write(&input_path, input)?;
|
||||||
@ -226,7 +225,7 @@ impl Worker {
|
|||||||
input: &str,
|
input: &str,
|
||||||
style: &TypstStyle,
|
style: &TypstStyle,
|
||||||
) -> Result<Image, ThirdPartyRenderError> {
|
) -> Result<Image, ThirdPartyRenderError> {
|
||||||
let workdir = tempdir_in(&self.shared.root_dir)?;
|
let workdir = tempfile::Builder::default().prefix(".presenterm").tempdir_in(&self.shared.root_dir)?;
|
||||||
let mut typst_input = Self::generate_page_header(style)?;
|
let mut typst_input = Self::generate_page_header(style)?;
|
||||||
typst_input.push_str(input);
|
typst_input.push_str(input);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user