Skip to content

Commit

Permalink
Resolve $HOME the same way as ~ for paths
Browse files Browse the repository at this point in the history
  • Loading branch information
zappolowski committed Oct 14, 2023
1 parent 720572e commit 904ce6f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 904ce6f

Please sign in to comment.