Create screenshot directory if it doesn't exist

This commit is contained in:
Ivan Molodetskikh
2024-03-28 20:59:42 +04:00
parent cf409a4ea6
commit 9b7ed57d37
+8
View File
@@ -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) => {