regisf / virtualenvwrapper-powershell

A mimic of the VirtualEnvWrapper project but with Powershell
MIT License
109 stars 28 forks source link

PowerShell Core 7.x Compatibility Fixes #23

Closed mmorys closed 3 years ago

mmorys commented 3 years ago

In the open source PowerShell Core, the directory containing the user's profile is PowerShell instead of WindowsPowerShell. Instead of finding the MyDocuments directory and building up the profile path from there, hardcoding in WindowsPowerShell, the proposed changes utilize the $PROFILE variable itself to determine the path to use for profile edits.

It was determined from profile path used in the existing Install.ps1 script that the targeted profile is the one for the current user, and all hosts. Therefore, this profile is hardcoded in as the default profile in the proposed script as well.

This provides compatibility between Windows PowerShell 5.1 shipped with Windows, and PowerShell Core, automatically setting the correct profile directory.

regisf commented 3 years ago

Hi @mmorys Thanks for your contribution. It works like a charm on PowerShell 5.1.