X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=parser%2Fparse.c;h=897d738f417fbe183e78246d9cb7a28cdfb09580;hb=35ce211ec3ba025b67b5b91ecf10c1b1b2294a43;hp=636b451f2b5d3a937b76279ebdf971bc3b767655;hpb=bbad88aa21f01a70faf824cbb2825bd7f9d95253;p=chaz%2Fopenbox diff --git a/parser/parse.c b/parser/parse.c index 636b451f..897d738f 100644 --- a/parser/parse.c +++ b/parser/parse.c @@ -456,14 +456,17 @@ void parse_paths_shutdown(void) gchar *parse_expand_tilde(const gchar *f) { - gchar **spl; gchar *ret; + GRegex *regex; if (!f) return NULL; - spl = g_strsplit(f, "~", 0); - ret = g_strjoinv(g_get_home_dir(), spl); - g_strfreev(spl); + + regex = g_regex_new("(?:^|(?<=[ \\t]))~(?:(?=[/ \\t])|$)", + G_REGEX_MULTILINE | G_REGEX_RAW, 0, NULL); + ret = g_regex_replace_literal(regex, f, -1, 0, g_get_home_dir(), 0, NULL); + g_regex_unref(regex); + return ret; }