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

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

Merged
merged 4 commits into from
Aug 22, 2021

Conversation

rennerom
Copy link
Contributor

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...

  • $IsOSX isn't working as expected. Perhaps it should be $IsMacOS? In any case, I opted for [System.Environment]::OSVersion.Platform -eq "Unix" as a catch all for non-windows systems
  • I replaced the hard coded Module paths assigned to $dest with environment variables instead.
  • if logic for Windows vs Non-Windows machines in assigning $psd1 and in the final Copy-Item statement.

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

@dfinke dfinke merged commit 8d61b9c into dfinke:master Aug 22, 2021
@dfinke
Copy link
Owner

dfinke commented Aug 22, 2021

Thank you for the PR!

@rennerom
Copy link
Contributor Author

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
Copy link
Owner

dfinke commented Aug 24, 2021

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

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

Successfully merging this pull request may close these issues.

2 participants