Change path of temporary file to be absolute

Signed-off-by: trivernis <trivernis@protonmail.com>
develop
trivernis 4 years ago
parent 0495855d91
commit c7694d39e0
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -13,6 +13,7 @@ use crate::utils::caching::CacheStorage;
use bibliographix::Mutex; use bibliographix::Mutex;
use headless_chrome::protocol::page::PrintToPdfOptions; use headless_chrome::protocol::page::PrintToPdfOptions;
use headless_chrome::{Browser, Tab}; use headless_chrome::{Browser, Tab};
use std::env;
use std::fs; use std::fs;
use std::fs::OpenOptions; use std::fs::OpenOptions;
use std::io::BufWriter; use std::io::BufWriter;
@ -30,7 +31,8 @@ pub fn render_to_pdf(document: Document) -> PdfRenderingResult<Vec<u8>> {
file_path = cache.get_file_path(&file_path); file_path = cache.get_file_path(&file_path);
if !file_path.parent().map(|p| p.exists()).unwrap_or(false) { 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(); let config = document.config.clone();

Loading…
Cancel
Save