Skip to content

create stored_saving_location if not existing, fallback to saving_location on error#297

Open
VeldoraTheDragon wants to merge 3 commits intoSeaDve:mainfrom
VeldoraTheDragon:veldora_create-dir-from-stored_saving_location
Open

create stored_saving_location if not existing, fallback to saving_location on error#297
VeldoraTheDragon wants to merge 3 commits intoSeaDve:mainfrom
VeldoraTheDragon:veldora_create-dir-from-stored_saving_location

Conversation

@VeldoraTheDragon
Copy link
Copy Markdown

Currently, the default directory Kooha gets created, if it's not existing.

However if a different directory is being set via dbus-option e.g saving-location=b'/home/{{ USERNAME }}/Screencasts' in corporate organizations via config-management, the directory doesn't get created automatically, instead it fails in an error.

This PR fixes this issue, by moving:

        let saving_location =
            glib::user_special_dir(glib::UserDirectory::Videos).unwrap_or_else(glib::home_dir);

further up and expanding !stored_saving_location.as.os.str().is_empty() with.

            if let Err(err) = fs::create_dir_all(&stored_saving_location) {
                tracing::warn!(
                    "Failed to create dir at `{}`: {:?}",
                    stored_saving_location.display(),
                    err
                );
                return saving_location;
            }

where a fallback to saving_location is set, in case it fails to create the directory set via saving-location option.

I've tested it on an Arch Linux machine by building it via a modified PKGBUILD of the official PKGBUILD and it worked flawlessly in my case.

@SeaDve
Copy link
Copy Markdown
Owner

SeaDve commented Jul 17, 2024

Hi, thanks for the PR, and sorry for the very late response

Comment thread src/settings.rs Outdated
Comment thread src/settings.rs Outdated
@SeaDve
Copy link
Copy Markdown
Owner

SeaDve commented Jul 17, 2024

The failing ci is btw unrelated to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants