diff options
| author | Mikael Magnusson <mikachu@gmail.com> | 2009-07-05 22:27:25 +0200 |
|---|---|---|
| committer | Mikael Magnusson <mikachu@gmail.com> | 2009-09-19 15:03:12 +0200 |
| commit | 308478e4a5f4dc76d69395dda8a9bc42cb69eec4 (patch) | |
| tree | 54ec31d91428b2a7d3e4c7bdf902fe182abfc25d /obt/paths.c | |
| parent | 3f72b9d67f21781e513a9c058e8624b8b86b92ea (diff) | |
| parent | ba1ac214dfdbc0539c922e84c2318c1bf2566c0c (diff) | |
Merge branch 'backport' into work
Conflicts:
openbox/actions/desktop.c
openbox/client.c
openbox/event.c
openbox/extensions.c
openbox/popup.c
openbox/screen.c
parser/parse.c
Diffstat (limited to 'obt/paths.c')
| -rw-r--r-- | obt/paths.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/obt/paths.c b/obt/paths.c index 61004998..68615433 100644 --- a/obt/paths.c +++ b/obt/paths.c @@ -169,14 +169,16 @@ void obt_paths_unref(ObtPaths *p) gchar *obt_paths_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; } |
