mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +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 {
|
if let Some(path) = path {
|
||||||
debug!("saving screenshot to {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) {
|
match std::fs::write(&path, buf) {
|
||||||
Ok(()) => image_path = Some(path),
|
Ok(()) => image_path = Some(path),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user