summaryrefslogtreecommitdiffstats
path: root/win/tclWinInit.c
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2022-09-05 12:18:35 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2022-09-05 12:18:35 (GMT)
commit57807a30bb766ff5e18b94270ac3d92041b006af (patch)
treefd34480b0ef994873e28763b760b70eb782d3213 /win/tclWinInit.c
parent46cf6812fcfb415aae1696cf0b29cd2a6a77917a (diff)
parent1197ccadc0ba24b8f5dc9debc59ca25593067f64 (diff)
downloadtcl-57807a30bb766ff5e18b94270ac3d92041b006af.zip
tcl-57807a30bb766ff5e18b94270ac3d92041b006af.tar.gz
tcl-57807a30bb766ff5e18b94270ac3d92041b006af.tar.bz2
Merge 8.6. Primarily ticket [55a02f20ec]
Diffstat (limited to 'win/tclWinInit.c')
-rw-r--r--win/tclWinInit.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index fdeb0aa..8fa176b 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -527,7 +527,14 @@ TclpSetVariables(
Tcl_SetVar2(interp, "env", "HOME", Tcl_DStringValue(&ds),
TCL_GLOBAL_ONLY);
} else {
- Tcl_SetVar2(interp, "env", "HOME", "c:\\", TCL_GLOBAL_ONLY);
+ /* None of HOME, HOMEDRIVE, HOMEPATH exists. Try USERPROFILE */
+ ptr = Tcl_GetVar2(interp, "env", "USERPROFILE", TCL_GLOBAL_ONLY);
+ if (ptr != NULL && ptr[0]) {
+ Tcl_SetVar2(interp, "env", "HOME", ptr, TCL_GLOBAL_ONLY);
+ } else {
+ /* Last resort */
+ Tcl_SetVar2(interp, "env", "HOME", "c:\\", TCL_GLOBAL_ONLY);
+ }
}
}