Skip to content

Commit 76b8dea

Browse files
committed
comments added to make design more clear
1 parent 37ed41b commit 76b8dea

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tcl/envmngt.tcl.in

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1816,14 +1816,23 @@ proc add-path {cmd mode dflbhv args} {
18161816
set val [get-env $var]
18171817

18181818
foreach dir $path_list {
1819+
# With the following variable, we indicate that $dir has been removed
1820+
# from the path if path_entry_reorder is true and duplicates are not
1821+
# allowed.
18191822
set dir_removed 0
18201823
if {[getConf path_entry_reorder]} {
18211824
if {[info exists countarr($dir)] && ! $allow_dup} {
1822-
# remove dir if in $val and duplicates are not allowed
1825+
# if $dir is in $val and duplicates are not allowed:
1826+
# first remove all occurences of $dir in $val
1827+
# and add $dir at the beginning or end later again
18231828
set mpath_list [split $val $separator]
18241829
set mpath_list [lsearch -inline -all -not -exact $mpath_list $dir]
18251830
set val [join $mpath_list $separator]
1831+
1832+
# Set counter to 0. Unfortunatelly we cannot use countarr($dir)
1833+
# in the following if statement.
18261834
set countarr($dir) 0
1835+
# make sure $dir is added again
18271836
set dir_removed 1
18281837
}
18291838
}

0 commit comments

Comments
 (0)