screencastService: Handle case where no videos directory exists

The videos directory doesn't necessarily have to exist, users are free to
delete it. Right now we don't handle this case and screencasting fails.

Let's handle it and fall back to the users home directory instead when
xdg-videos doesn't exist.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2594>
This commit is contained in:
Jonas Dreßler 2023-01-04 14:03:14 +01:00 committed by Florian Müllner
parent 3ef0ec9255
commit 2d66fafbff

View file

@ -315,7 +315,10 @@ var ScreencastService = class extends ServiceImplementation {
if (GLib.path_is_absolute(filename))
return filename;
let videoDir = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_VIDEOS);
const videoDir =
GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_VIDEOS) ||
GLib.get_home_dir();
return GLib.build_filenamev([videoDir, filename]);
}