diff options
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-utils.c | 19 | ||||
-rw-r--r-- | libempathy/empathy-utils.h | 3 |
2 files changed, 21 insertions, 1 deletions
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index 25e0860d2..07cd6802e 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -587,3 +587,22 @@ empathy_presence_from_str (const gchar *str) return MC_PRESENCE_AVAILABLE; } +gchar * +empathy_file_lookup (const gchar *filename, const gchar *subdir) +{ + gchar *path; + + if (!subdir) { + subdir = "."; + } + + path = g_build_filename (g_getenv ("EMPATHY_SRCDIR"), subdir, filename, NULL); + if (!g_file_test (path, G_FILE_TEST_EXISTS)) { + g_free (path); + path = g_build_filename (DATADIR, "empathy", filename, NULL); + } + + return path; +} + + diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h index cafc3db10..834935ef2 100644 --- a/libempathy/empathy-utils.h +++ b/libempathy/empathy-utils.h @@ -97,7 +97,8 @@ void empathy_chat_with_contact_id (McAccount *account, const gchar * empathy_presence_get_default_message (McPresence presence); const gchar * empathy_presence_to_str (McPresence presence); McPresence empathy_presence_from_str (const gchar *str); - +gchar * empathy_file_lookup (const gchar *filename, + const gchar *subdir); G_END_DECLS #endif /* __EMPATHY_UTILS_H__ */ |