From 790ff4f8265c5156828ec8f04c0bf28eebd261b9 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sun, 6 Dec 2015 10:12:59 +0100 Subject: [PATCH] Added function ::file_exists. --- src/generic.c | 20 ++++++++++++++++++++ src/generic.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/src/generic.c b/src/generic.c index dfe8b07..3522f64 100644 --- a/src/generic.c +++ b/src/generic.c @@ -26,6 +26,26 @@ #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: diff --git a/src/generic.h b/src/generic.h index 7f3f038..d654bc5 100644 --- a/src/generic.h +++ b/src/generic.h @@ -22,11 +22,14 @@ #include #include +#include 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); -- 2.49.0