aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/niri.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/niri.rs b/src/niri.rs
index b36b0f55..2de30eca 100644
--- a/src/niri.rs
+++ b/src/niri.rs
@@ -3309,6 +3309,14 @@ impl Niri {
if let Some(path) = path {
debug!("saving screenshot to {path:?}");
+ if let Some(parent) = path.parent() {
+ if let Err(err) = std::fs::create_dir(parent) {
+ if err.kind() != std::io::ErrorKind::AlreadyExists {
+ warn!("error creating screenshot directory: {err:?}");
+ }
+ }
+ }
+
match std::fs::write(&path, buf) {
Ok(()) => image_path = Some(path),
Err(err) => {