From: Andrea Zagli Date: Sun, 6 Dec 2015 09:12:59 +0000 (+0100) Subject: Added function ::file_exists. X-Git-Tag: v0.0.1~12 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=790ff4f8265c5156828ec8f04c0bf28eebd261b9;p=libzakutils Added function ::file_exists. --- 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);