Merge branch '113-modulefile-fix-path-mangling' into 'master'

Resolve "modulefile: fix PATH mangling"

Closes #113

See merge request Pmodules/src!81
This commit is contained in:
2021-05-06 10:33:25 +02:00
+14
View File
@@ -8,3 +8,17 @@ module-maintainer "Achim Gsell <achim.gsell@psi.ch>"
module-help "
Pmodules are a hierarchical module environment based on Environment Modules.
"
#
# It might be that '${PMODULES_ROOT}/Tools/Pmodules/VERSION' is in PATH.
# Why? With older version the PATH might have been set without loading
# a module.
#
if { [module-info mode load] } {
set PATH ":$::env(PATH):"
if { [regexp -- {.*:(.*/Pmodules/[^:]*):} $PATH -> str] } {
if { [string compare $str $PREFIX/bin] != 0 } {
remove-path PATH $str
}
}
}