mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
Create screenshot directory if it doesn't exist
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user