File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments