Launcher: Replace ~/ by $HOME/
This commit is contained in:
@@ -275,7 +275,17 @@ complete_on_files(char *start, size_t hits)
|
|||||||
path = _strdup(".");
|
path = _strdup(".");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dirname = _strdup(p);
|
/* remplace ~ by $HOME in dirname */
|
||||||
|
if (!strncmp(p, "~/", 2) && getenv("HOME"))
|
||||||
|
asprintf(&dirname, "%s%s", getenv("HOME"), p+1);
|
||||||
|
else
|
||||||
|
dirname = _strdup(p);
|
||||||
|
|
||||||
|
/* Set p to filename to be complete
|
||||||
|
* and path the directory containing the file
|
||||||
|
* /foooooo/baaaaaar/somethinglikethis<tab>
|
||||||
|
* <---- path - ---><------- p ------>
|
||||||
|
*/
|
||||||
p = strrchr(dirname, '/');
|
p = strrchr(dirname, '/');
|
||||||
if (p != dirname)
|
if (p != dirname)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user