From ffe812cecd1eaea04eeb6c53ae01424a212cb224 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Fri, 14 Feb 2020 07:08:41 +0100 Subject: [PATCH] Enclose mod and modpath names if space in them when saving coll --- modulecmd.tcl.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modulecmd.tcl.in b/modulecmd.tcl.in index 3e275b9f..60f1662b 100644 --- a/modulecmd.tcl.in +++ b/modulecmd.tcl.in @@ -8508,6 +8508,10 @@ proc formatCollectionContent {path_list mod_list nuasked_list {sgr 0}} { # start collection content with modulepaths foreach path $path_list { + # enclose path if space character found in it + if {[string first { } $path] != -1} { + set path "{$path}" + } # 'module use' prepends paths by default so we clarify # path order here with --append flag append content "$modcmd use --append $path" \n @@ -8517,6 +8521,10 @@ proc formatCollectionContent {path_list mod_list nuasked_list {sgr 0}} { foreach mod $mod_list { # mark modules not asked by user to restore the user asked state set opt [expr {[isInList $nuasked_list $mod] ? {--notuasked } : {}}] + # enclose module if space character found in it + if {[string first { } $mod] != -1} { + set mod "{$mod}" + } append content "$modcmd load $opt$mod" \n }