From b1fbf56f7f7ddc04ca0f2dcfb20f327c3d70cb16 Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Wed, 3 Jul 2024 09:22:49 -0400 Subject: [PATCH] Create directories --- src/sink.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sink.rs b/src/sink.rs index d2967f7..1051279 100644 --- a/src/sink.rs +++ b/src/sink.rs @@ -36,7 +36,11 @@ impl ElementSink { } pub fn finish_batch(&mut self) { - let file = File::create(self.new_file_path(&self.filenum)).unwrap(); + let path_str = self.new_file_path(&self.filenum); + let path = std::path::Path::new(&path_str); + let prefix = path.parent().unwrap(); + std::fs::create_dir_all(prefix).unwrap(); + let file = File::create(path).unwrap(); let batch = self.osm_builder.finish().unwrap();