Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
maros17 opened this issue Oct 20, 2021 · 0 comments

Comments

@maros17
Copy link

maros17 commented Oct 20, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant