Skip to content

Commit

Permalink
Update docs regarding tilde substitution (backported from 9.0). For T…
Browse files Browse the repository at this point in the history
…CLLIBPATH, do the same tilde substitution as done for TCLx.y_TM_PATH (backported from 9.0 too)
  • Loading branch information
jan.nijtmans committed Oct 23, 2024
1 parent e5d1b8b commit ab3a945
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/tclvars.n
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ the parent directory of \fBtcl_library\fR,
the directories listed in the \fBtcl_pkgPath\fR variable.
Additional locations to look for files and package indices should
normally be added to this variable using \fBlappend\fR.
Initialization of auto_path from the TCLLIBPATH environment
variable undergoes tilde substitution (see \fBfilename\fR) on each
path. Any tilde substitution that fails because the user is unknown
will be omitted from auto_path.
.RS
.PP
Additional variables relating to package management exist. More
Expand Down
4 changes: 4 additions & 0 deletions doc/tm.n
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ environment variables:
\fB$::env(TCL8.1_TM_PATH)\fR \fB$::env(TCL8_1_TM_PATH)\fR
\fB$::env(TCL8.0_TM_PATH)\fR \fB$::env(TCL8_0_TM_PATH)\fR
.CE
.PP
Paths initialized from the environment variables undergo tilde
substitution (see \fBfilename\fR). Any path whose tilde substitution
fails because the user is unknown will be omitted from search paths.
.SH "SEE ALSO"
package(n), Tcl Improvement Proposal #189
.QW "\fITcl Modules\fR"
Expand Down
10 changes: 9 additions & 1 deletion library/init.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ package require -exact tcl 8.7b1

if {![info exists auto_path]} {
if {[info exists env(TCLLIBPATH)] && (![interp issafe])} {
set auto_path $env(TCLLIBPATH)
set auto_path [apply {{} {
lmap path $::env(TCLLIBPATH) {
# Paths relative to unresolvable home dirs are ignored
if {[catch {file tildeexpand $path} expanded_path]} {
continue
}
set expanded_path
}
}}]
} else {
set auto_path ""
}
Expand Down

0 comments on commit ab3a945

Please sign in to comment.