Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cmd.cmd in the pre-built package for Windows sets MODULESHOME incorrectly in certain cases #525

@v-clone

Description

@v-clone

Description

Depending on the actual name of the top-level directory where the pre-built package for Windows is unpacked into, the line in the cmd.cmd that sets the MODULESHOME environment variable may set the variable to the wrong value.

To Reproduce

  • Download, for example, the pre-built package for Windows called modules-5.3.1-win.zip.
  • Unzip into a folder with the same name e.g. c:\temp\modules\modules-5.3.1-win
  • Run cmd.cmd
$ c:\temp\modules\modules-5.3.1-win\init\cmd.cmd
couldn't read file "c:\temp\modules\modules-5.3\libexe\modulecmd.tcl

Notice how it seems to be thinking that one of the path segments is "modules-5.3", when it should be "modules-5.3.1-win"

Comment

The issue seems to be in the following line in cmd.cmd:

for %%i in ("%~dp0..") do set "MODULESHOME=%%~dpni"

The "~dpni" seems to be treating ".1-win" as an extension and so that portion gets lost.

A solution could possibly be to use "~dpnxi" instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions