[gnome-sound-recorder/bilelmoussaoui/fixes: 6/12] properly handle data & cache dir creations




commit 503a08d71d595e408445dc1481c6b2ca62fee318
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Wed Sep 9 02:57:05 2020 +0200

    properly handle data & cache dir creations

 src/application.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index b55050e..d5c7887 100644
--- a/src/application.js
+++ b/src/application.js
@@ -87,11 +87,14 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
         Handy.init();
         Gst.init(null);
 
-        if (!RecordingsDir.query_exists(null))
+        try {
             RecordingsDir.make_directory_with_parents(null);
-        if (!CacheDir.query_exists(null))
             CacheDir.make_directory_with_parents(null);
-
+        } catch (e) {
+            if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS)) {
+                warn(`Failed to create directory ${e}`)
+            }
+        }
         this._initAppMenu();
     }
 


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