Is #752 - Add windows tilde expansion
This commit is contained in:
parent
86b52dc108
commit
94e62b24ff
20
src/config.c
20
src/config.c
|
@ -877,8 +877,26 @@ static ctmbstr ExpandTilde( TidyDocImpl* doc, ctmbstr filename )
|
|||
if (filename[1] == '/')
|
||||
{
|
||||
home_dir = getenv("HOME");
|
||||
if ( home_dir )
|
||||
if (home_dir) {
|
||||
++filename;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
else if (strlen(filename) >= 3) { /* at least '~/+1' */
|
||||
/* no HOME env in Windows - got for HOMEDRIVE=C: HOMEPATH=\Users\user */
|
||||
char * hd = getenv("HOMEDRIVE");
|
||||
char * hp = getenv("HOMEPATH");
|
||||
if (hd && hp) {
|
||||
ctmbstr s = TidyDocAlloc(doc, _MAX_PATH);
|
||||
strcpy(s, hd);
|
||||
strcat(s, hp);
|
||||
strcat(s, "\\");
|
||||
strcat(s, &filename[2]);
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
}
|
||||
#ifdef SUPPORT_GETPWNAM
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue