[gnome-shell/gnome-42] screenshot: Fall back to home if Pictures directory is not available



commit 2e1abee1b8983692df59c9ceb4e70c6158540dc5
Author: Sam Uong <samuong gmail com>
Date:   Mon Jun 6 10:45:25 2022 +0000

    screenshot: Fall back to home if Pictures directory is not available
    
    GLib.get_user_special_dir() returns null if user directories are
    disabled. Instead of failing silently, fall back to saving screenshots
    in $HOME/Screenshots in that case
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5549
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2327>
    (cherry picked from commit ea60bf4bc7770135f35bab571a7ecee473057abc)

 js/ui/screenshot.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
index 33ea6e85b8..5153ea418f 100644
--- a/js/ui/screenshot.js
+++ b/js/ui/screenshot.js
@@ -2064,7 +2064,7 @@ function _storeScreenshot(bytes, pixbuf) {
 
     if (!disableSaveToDisk) {
         const dir = Gio.File.new_for_path(GLib.build_filenamev([
-            GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES),
+            GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES) || GLib.get_home_dir(),
             // Translators: name of the folder under ~/Pictures for screenshots.
             _('Screenshots'),
         ]));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]