diff options
author | portix <none@none> | 2012-04-18 11:05:35 +0200 |
---|---|---|
committer | portix <none@none> | 2012-04-18 11:05:35 +0200 |
commit | e9bb365b9be5f67d20c899af4e5a084daaad9670 (patch) | |
tree | 17ccb1fa507d014138a12620dea6993d037fd79e /src/util.c | |
parent | aaf6a04c7e232c5d461bfa50230754cba52c6f54 (diff) | |
download | dwb-e9bb365b9be5f67d20c899af4e5a084daaad9670.zip |
Adding scripts/lib, implementing signal functions
--HG--
branch : scripts
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -243,7 +243,7 @@ util_web_settings_sort_second(WebSettings *a, WebSettings *b) { /*util_get_directory_content(GString **, const char *filename) {{{*/ void -util_get_directory_content(GString **buffer, const char *dirname, const char *extension) { +util_get_directory_content(GString *buffer, const char *dirname, const char *extension) { GDir *dir; char *content; GError *error = NULL; @@ -263,7 +263,7 @@ util_get_directory_content(GString **buffer, const char *dirname, const char *ex } filepath = g_build_filename(dirname, filename, NULL); if (g_file_get_contents(filepath, &content, NULL, &error)) { - g_string_append((*buffer), content); + g_string_append(buffer, content); } else { fprintf(stderr, "Cannot read %s: %s\n", filename, error->message); @@ -423,6 +423,16 @@ util_get_user_data_dir(const char *dir) { return path; }/*}}}*/ +char * +util_get_data_dir(const char *dir) { + char *path; + if ( (path = util_get_user_data_dir(dir)) ) + return path; + if ( (path = util_get_system_data_dir(dir)) ) + return path; + return NULL; +} + /* util_get_data_file(const char *filename) return: filename (alloc) or NULL {{{*/ char * |