[shotwell] Fixed. Check .cache directory for read/write permissions (#737747)



commit 1caa898c0a58291f1b47bac85c3bed9895d1d1af
Author: Wolfgang Steitz <wsteitz gmail com>
Date:   Tue Mar 31 19:50:05 2015 +0200

    Fixed. Check .cache directory for read/write permissions (#737747)

 src/AppDirs.vala |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/AppDirs.vala b/src/AppDirs.vala
index 1cdfde6..8b792dc 100644
--- a/src/AppDirs.vala
+++ b/src/AppDirs.vala
@@ -212,14 +212,16 @@ class AppDirs {
     }
 
     public static void ensure_writable(File dir) {
-        try {
-            FileInfo info = dir.query_info(FileAttribute.UNIX_MODE, FileQueryInfoFlags.NONE);
-            uint32 mode = info.get_attribute_uint32(FileAttribute.UNIX_MODE) | 0700;
-            if (!dir.set_attribute_uint32(FileAttribute.UNIX_MODE, mode, FileQueryInfoFlags.NONE)) {
-                AppWindow.panic(_("Could not make dir %s writable").printf(dir.get_path()));
+        if (dir.query_exists(null)) {
+            try {
+                FileInfo info = dir.query_info(FileAttribute.UNIX_MODE, FileQueryInfoFlags.NONE);
+                uint32 mode = info.get_attribute_uint32(FileAttribute.UNIX_MODE) | 0700;
+                if (!dir.set_attribute_uint32(FileAttribute.UNIX_MODE, mode, FileQueryInfoFlags.NONE)) {
+                    AppWindow.panic(_("Could not make dir %s writable").printf(dir.get_path()));
+                }
+            } catch (Error err) {
+                AppWindow.panic(_("Could not make dir %s writable: %s").printf(dir.get_path(), err.message));
             }
-        } catch (Error err) {
-            AppWindow.panic(_("Could not make dir %s writable: %s").printf(dir.get_path(), err.message));
         }
     }
 


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