equal
deleted
inserted
replaced
48 // expand_filename(filename) |
48 // expand_filename(filename) |
49 // Expand "~/" with the $HOME env. variable in a file name. |
49 // Expand "~/" with the $HOME env. variable in a file name. |
50 // The caller must free the string after use. |
50 // The caller must free the string after use. |
51 char *expand_filename(const char *fname) |
51 char *expand_filename(const char *fname) |
52 { |
52 { |
|
53 if (!fname) |
|
54 return NULL; |
53 if (!strncmp(fname, "~/", 2)) { |
55 if (!strncmp(fname, "~/", 2)) { |
54 char *homedir = getenv("HOME"); |
56 char *homedir = getenv("HOME"); |
55 if (homedir) |
57 if (homedir) |
56 return g_strdup_printf("%s%s", homedir, fname+1); |
58 return g_strdup_printf("%s%s", homedir, fname+1); |
57 } |
59 } |