dfinke / InstallModuleFromGitHub

Install PowerShell Modules from GitHub
Apache License 2.0
87 stars 31 forks source link

Errors on Windows #28

Open AussieWoji opened 1 year ago

AussieWoji commented 1 year ago

This worked great on Mac but I encountered errors on Windows. It errors on the Get-Childitem and then the Copy-Item towards the end of the process. Both are contained in an if statement to check the operating system. In testing, it appears these if statements are not necessary. When I stepped through and used the UNIX versions for each of the Get-ChildItem and Copy-Item commands they worked as expected.

AussieWoji commented 1 year ago

It does look like there is a pull request ready to be merged with the fix for this.

dfinke commented 1 year ago

Please post more detail on both the issue and PR

AussieWoji commented 1 year ago

Get-ChildItem: Cannot find path 'C:\Users\paul\AppData\Local\Temp\4597321876E46F17A031B679ABE80F5DCDA0BD350BCF27485383801C570FF7D0\C:\Users\paul\AppData\Local\Temp\4597321876E46F17A031B679ABE80F5DCDA0BD350BCF27485383801C570FF7D0\AussieWoji-Wojis.IT.TeamTools-2fe45c27e070ccf647bcba28000584044863a773'
because it does not exist. Copy-Item: Cannot find path'C:\Users\paul\AppData\Local\Temp\4597321876E46F17A031B679ABE80F5DCDA0BD350BCF27485383801C570FF7D0\C:\Users\paul\AppData\Local\Temp\4597321876E46F17A031B679ABE80F5DCDA0BD350BCF27485383801C570FF7D0\AussieWoji-Wojis.IT.TeamTools-2fe45c27e070ccf647bcba28000584044863a773'
because it does not exist.

The path is wrong because the if statements are using a Join-Path to put two paths together that do not work. You cannot have two C: in a valid path. I found that if you just remove the If statements it works fine. Probably because you have already decided if the path is Unix or Windows earlier in the script.

I know nothing about the PR other than it says it addresses this issue. When I look at its code it is not the way I would do it, but that is the beauty of code, everyone can do it their own way.