Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

VeldoraTheDragon
Copy link

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
Owner

SeaDve commented Jul 17, 2024

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

src/settings.rs Outdated Show resolved Hide resolved
src/settings.rs Outdated Show resolved Hide resolved
@SeaDve
Copy link
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