dfinke / InstallModuleFromGitHub

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

Updated some MacOS path issues and added CurrentUser Scope param #22

Closed rennerom closed 3 years ago

rennerom commented 3 years ago

I was having a few issues using this on macos and added some fixes for the $psd1 path. It's maybe not the most elegant, but it's working well on my mac and my windows pc. Additionally, since I dont have permissions to install modules system wide, I added a CurrentUser scope optional parameter.

Some Changes I made...

If you prefer this PR be broken down into smaller chunks, I can do that too. Just let me know. Thanks!

dfinke commented 3 years ago

Thank you for the PR!

rennerom commented 3 years ago

Thanks @dfinke. Coincidentally, I submitted an issue with Microsoft PS Documentation the same day I created this PR. What came from that was confirmation the scoped paths I provided in my code are only for PS 5.1, where 7 and above have a slightly different module path (they use the directory “\PowerShell\Modules” instead of “\WindowsPowerShell\Modules”). If you like, I can make the fix and submit a new PR before too many folks notice. A simple $PSVersionTable.PSVersion lookup would do the trick. Or if you prefer, I can simply change it for PS version 7 and later and I can keep a fork for myself to deal with 5.1 (why won’t my job update their powershell?!?!) Let me know your preference.

dfinke commented 3 years ago

@rennerom Thanks! Yes v7 and later is best. Yeah, 5.1 is good, some places still run PS 2.0 :-)