diff --git a/src/utils.c b/src/utils.c index 61bc43d83..9a4c1695f 100644 --- a/src/utils.c +++ b/src/utils.c @@ -180,12 +180,10 @@ int string_array_length(char **s) char *string_to_path(char *string) { - if (string && STRN_EQ(string, "~/", 2)) { - char *home = g_strconcat(user_get_home(), "/", NULL); - - string = string_replace_at(string, 0, 2, home); - - g_free(home); + if (string && (STRN_EQ(string, "~/", 2) || STRN_EQ(string, "$HOME/", 6))) { + char *ret = g_strconcat(user_get_home(), strstr(string, "/"), NULL); + g_free(string); + return ret; } return string;