Util: Add patht function to transform path: '~/' is now allowed

This commit is contained in:
Martin Duquesnoy
2010-08-02 19:20:06 +02:00
parent 00638264d3
commit 36ca03f8f3
4 changed files with 24 additions and 4 deletions

View File

@@ -340,3 +340,21 @@ clean_value(char *str)
return p;
}
/* To use ~/ shortcut.. */
char*
patht(char *path)
{
static char ret[512];
if(!path)
return NULL;
strcpy(ret, path);
if(strstr(path, "~/"))
sprintf(ret, "%s/%s", getenv("HOME"), path + 2);
printf("--> (%s) - %s\n", path, ret);
return ret;
}