]> saetta.ns0.it Git - libzakutils/commitdiff
Added function ::file_exists.
authorAndrea Zagli <azagli@libero.it>
Sun, 6 Dec 2015 09:12:59 +0000 (10:12 +0100)
committerAndrea Zagli <azagli@libero.it>
Sun, 6 Dec 2015 09:12:59 +0000 (10:12 +0100)
src/generic.c
src/generic.h

index dfe8b0771a31cd57228831a5632821bca91af6ec..3522f64e0d74dda634c8b1b923d37777d879cb57 100644 (file)
 
 #include "generic.h"
 
+
+/**
+ * zak_utils_file_exists:
+ * @filename:
+ *
+ */
+gboolean
+zak_utils_file_exists (const gchar *filename)
+{
+       gboolean ret;
+
+       GFile *f = g_file_new_for_path (filename);
+
+       ret = g_file_query_exists (f, NULL);
+
+       g_object_unref (f);
+
+       return ret;
+}
+
 /**
  * zak_utils_round:
  * @value:
index 7f3f03883affde2dd73265fef211142a6fe40a57..d654bc5915677fb9ba514935a89c5cb86bd67d0a 100644 (file)
 
 #include <glib.h>
 #include <glib-object.h>
+#include <gio/gio.h>
 
 
 G_BEGIN_DECLS
 
 
+gboolean zak_utils_file_exists (const gchar *filename);
+
 gdouble zak_utils_round (gdouble value, guint n_decimals);
 
 void zak_utils_gstring_initial_capital (GString *gstring);