summaryrefslogtreecommitdiff
path: root/backends/key-file/kf-persona-store.vala
diff options
context:
space:
mode:
Diffstat (limited to 'backends/key-file/kf-persona-store.vala')
-rw-r--r--backends/key-file/kf-persona-store.vala23
1 files changed, 19 insertions, 4 deletions
diff --git a/backends/key-file/kf-persona-store.vala b/backends/key-file/kf-persona-store.vala
index 885be12..3a81bdd 100644
--- a/backends/key-file/kf-persona-store.vala
+++ b/backends/key-file/kf-persona-store.vala
@@ -109,15 +109,30 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
}
}
- /* Create a new file; if this fails due to the file having been
- * created in the meantime, we can loop back round and try and load
- * it. */
+ /* Ensure the parent directory tree exists for the new file */
+ File parent_dir = this.file.get_parent ();
+
try
{
/* Recursively create the directory */
- File parent_dir = this.file.get_parent ();
parent_dir.make_directory_with_parents ();
+ }
+ catch (Error e3)
+ {
+ if (!(e3 is IOError.EXISTS))
+ {
+ warning ("The relationship key file directory '%s' could " +
+ "not be created: %s", parent_dir.get_path (), e3.message);
+ this.removed ();
+ return;
+ }
+ }
+ /* Create a new file; if this fails due to the file having been
+ * created in the meantime, we can loop back round and try and load
+ * it. */
+ try
+ {
/* Create the file */
FileOutputStream stream = yield this.file.create_async (
FileCreateFlags.PRIVATE, Priority.DEFAULT);