We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 86b52dc commit 94e62b2Copy full SHA for 94e62b2
src/config.c
@@ -877,8 +877,26 @@ static ctmbstr ExpandTilde( TidyDocImpl* doc, ctmbstr filename )
877
if (filename[1] == '/')
878
{
879
home_dir = getenv("HOME");
880
- if ( home_dir )
+ if (home_dir) {
881
++filename;
882
+ }
883
+#ifdef _MSC_VER
884
+ else if (strlen(filename) >= 3) { /* at least '~/+1' */
885
+ /* no HOME env in Windows - got for HOMEDRIVE=C: HOMEPATH=\Users\user */
886
+ char * hd = getenv("HOMEDRIVE");
887
+ char * hp = getenv("HOMEPATH");
888
+ if (hd && hp) {
889
+ ctmbstr s = TidyDocAlloc(doc, _MAX_PATH);
890
+ strcpy(s, hd);
891
+ strcat(s, hp);
892
+ strcat(s, "\\");
893
+ strcat(s, &filename[2]);
894
+ return s;
895
896
+
897
898
+#endif /* _MSC_VER */
899
900
}
901
#ifdef SUPPORT_GETPWNAM
902
else
0 commit comments