From dfe1df1339f72db54538c2331b08130c77ef08d3 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Mon, 6 Oct 2025 14:07:06 +0200 Subject: [PATCH] bvcomp: Create temporary directory if it does not exist --- webgraph/src/graphs/bvgraph/comp/impls.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/webgraph/src/graphs/bvgraph/comp/impls.rs b/webgraph/src/graphs/bvgraph/comp/impls.rs index 3edc7fe1..d1e47746 100644 --- a/webgraph/src/graphs/bvgraph/comp/impls.rs +++ b/webgraph/src/graphs/bvgraph/comp/impls.rs @@ -233,7 +233,14 @@ impl<'t> BvCompBuilder<'t> { self.owned_tmp_dir = Some(tmp_dir); } - Ok(self.tmp_dir.clone().unwrap()) + let tmp_dir = self.tmp_dir.clone().unwrap(); + if !std::fs::exists(&tmp_dir) + .with_context(|| format!("Could not check whether {} exists", tmp_dir.display()))? + { + std::fs::create_dir_all(&tmp_dir) + .with_context(|| format!("Could not create {}", tmp_dir.display()))?; + } + Ok(tmp_dir) } fn ensure_threads(&mut self) -> Result<()> {