From c7694d39e0aea534bcebdbc9a95c5f9f50027b5a Mon Sep 17 00:00:00 2001 From: trivernis Date: Tue, 13 Apr 2021 15:41:26 +0200 Subject: [PATCH] Change path of temporary file to be absolute Signed-off-by: trivernis --- src/format/chromium_pdf/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/format/chromium_pdf/mod.rs b/src/format/chromium_pdf/mod.rs index 5a5a5d5..1d13fee 100644 --- a/src/format/chromium_pdf/mod.rs +++ b/src/format/chromium_pdf/mod.rs @@ -13,6 +13,7 @@ use crate::utils::caching::CacheStorage; use bibliographix::Mutex; use headless_chrome::protocol::page::PrintToPdfOptions; use headless_chrome::{Browser, Tab}; +use std::env; use std::fs; use std::fs::OpenOptions; use std::io::BufWriter; @@ -30,7 +31,8 @@ pub fn render_to_pdf(document: Document) -> PdfRenderingResult> { file_path = cache.get_file_path(&file_path); if !file_path.parent().map(|p| p.exists()).unwrap_or(false) { - file_path = PathBuf::from(".tmp-document.html") + file_path = env::current_dir()?; + file_path.push(PathBuf::from(".tmp-document.html")) } let config = document.config.clone();