Mercurial > pidgin
changeset 5787:2adc29c88a45
[gaim-migrate @ 6212]
Changed the g_path_get_{dirname,basename} to our own functions, so it'll
actually work on Windows.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 07 Jun 2003 04:08:46 +0000 |
parents | f8bee920b14e |
children | 8c237274189f |
files | src/prefs.c |
diffstat | 1 files changed, 38 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/prefs.c Sat Jun 07 03:42:16 2003 +0000 +++ b/src/prefs.c Sat Jun 07 04:08:46 2003 +0000 @@ -139,6 +139,42 @@ } +static char * +get_path_dirname(const char *name) +{ + char *c, *str; + + str = g_strdup(name); + + if ((c = strrchr(str, '/')) != NULL) { + *c = '\0'; + + if (*str == '\0') { + g_free(str); + + str = g_strdup("/"); + } + } + else { + g_free(str); + + str = g_strdup("."); + } + + return str; +} + +static char * +get_path_basename(const char *name) +{ + const char *c; + + if ((c = strrchr(name, '/')) != NULL) + return g_strdup(c + 1); + + return g_strdup(name); +} + static char *pref_full_name(struct gaim_pref *pref) { GString *name; struct gaim_pref *parent; @@ -172,7 +208,7 @@ static struct gaim_pref *find_pref_parent(const char *name) { - char *parent_name = g_path_get_dirname(name); + char *parent_name = get_path_dirname(name); struct gaim_pref *ret = &prefs; if(strcmp(parent_name, "/")) { @@ -218,7 +254,7 @@ if(!parent) return NULL; - my_name = g_path_get_basename(name); + my_name = get_path_basename(name); for(sibling = parent->first_child; sibling; sibling = sibling->sibling) { if(!strcmp(sibling->name, my_name)) {