From 416ee379eaf1b9c0fb98e0367bd0e19d67d51bbb Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 1 Sep 2003 09:24:26 +0000 Subject: [PATCH] make ob_expand_tilde expand all tildes in the string --- openbox/openbox.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/openbox/openbox.c b/openbox/openbox.c index 21f3a606..4786ecc4 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -417,10 +417,15 @@ ObState ob_state() gchar *ob_expand_tilde(const gchar *f) { + gchar **spl; + gchar *ret, *mid; + if (!f) return NULL; - else if (f[0] != '~') - return g_strdup(f); - else - return g_strconcat(g_get_home_dir(), f+1, NULL); + spl = g_strsplit(f, "~", 0); + mid = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, NULL); + ret = g_strjoinv(mid, spl); + g_free(mid); + g_strfreev(spl); + return ret; } -- 2.39.2