[shotwell] Check .cache directory for read/write permissions (#737747)
- From: Wolfgang Steitz <wsteitz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell] Check .cache directory for read/write permissions (#737747)
- Date: Mon, 30 Mar 2015 18:02:28 +0000 (UTC)
commit 7408749d8514874a7b26962fdced2ab19e8d42ae
Author: Wolfgang Steitz <wsteitz gmail com>
Date: Sat Mar 28 18:53:40 2015 +0100
Check .cache directory for read/write permissions (#737747)
src/AppDirs.vala | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/AppDirs.vala b/src/AppDirs.vala
index 1421314..1cdfde6 100644
--- a/src/AppDirs.vala
+++ b/src/AppDirs.vala
@@ -211,8 +211,21 @@ class AppDirs {
return subdir;
}
+ 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()));
+ }
+ } catch (Error err) {
+ AppWindow.panic(_("Could not make dir %s writable: %s").printf(dir.get_path(), err.message));
+ }
+ }
+
public static File get_cache_subdir(string name, string? subname = null) {
File subdir = get_cache_dir().get_child(name);
+ ensure_writable(subdir);
if (subname != null)
subdir = subdir.get_child(subname);
@@ -223,7 +236,7 @@ class AppDirs {
AppWindow.panic(_("Unable to create data subdirectory %s: %s").printf(subdir.get_path(),
err.message));
}
-
+ ensure_writable(subdir);
return subdir;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]