Skip to content

Problem with Initialize-ModulePortable function - delets an important slash in some cases #29

@maros17

Description

@maros17

When using PS normal console's auto-complete, the address that auto completed contains a slash at the end.
In this case, the function (in line 79 in "Initialize-ModulePortable.ps1") does a replace of $path (that includes '\' at its end) to $psscriptroot, that causes the final result to be without the slash after $psscriptroot.

For example, if I run this command:

Initialize-ModulePortable -Name FileSplitter -Path C:\Users\Me\Desktop\ -Download

The file that will be created will contain that:

$Modules = @(
   "$PSScriptRootfilesplitter\1.3\FileSplitter.psd1"
)
foreach ($_ in $Modules) {
   Import-Module $_ -Verbose:$false -Force
}

If I am right in my diagnosis, it can be fixed by checking if $Path contains a slash (or back-slash) at its end and delete it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions