make ob_expand_tilde expand all tildes in the string
This commit is contained in:
parent
b90b0beaf9
commit
416ee379ea
1 changed files with 9 additions and 4 deletions
|
@ -417,10 +417,15 @@ ObState ob_state()
|
||||||
|
|
||||||
gchar *ob_expand_tilde(const gchar *f)
|
gchar *ob_expand_tilde(const gchar *f)
|
||||||
{
|
{
|
||||||
|
gchar **spl;
|
||||||
|
gchar *ret, *mid;
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
return NULL;
|
return NULL;
|
||||||
else if (f[0] != '~')
|
spl = g_strsplit(f, "~", 0);
|
||||||
return g_strdup(f);
|
mid = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, NULL);
|
||||||
else
|
ret = g_strjoinv(mid, spl);
|
||||||
return g_strconcat(g_get_home_dir(), f+1, NULL);
|
g_free(mid);
|
||||||
|
g_strfreev(spl);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue