coreybutler / nvm-windows

A node.js version management utility for Windows. Ironically written in Go.
MIT License
37.79k stars 3.34k forks source link

Installer improvements #457

Closed noelhibbard closed 8 months ago

noelhibbard commented 5 years ago

My windows account does not have admin rights so when I run the nvm installer it prompts for creds. When I type creds for an admin account the installer defaults to my correct user profile folder (not the admin's) but when it creates the %NVM_HOME% and %NVM_SYMLINK% vars and adds them to the %PATH% it's creating them in the admin's profile rather than my non-admin profile.

Inno Setup has an ExecAsOriginalUser function which will execute a program in the non-elevated environment which could be used to add the registry values to the correct HKCU.

For example:

ExecAsOriginalUser('REG', 'ADD HKCU\Environment /F /V NVM_HOME /D "' + ExpandConstant('{app}') + '"', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode)
ExecAsOriginalUser('REG', 'ADD HKCU\Environment /F /V NVM_SYMLINK /D "' + SymlinkPage.Values[0] + '"', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode)

Manipulating the path would require you to do REG QUERY and then parse the stdout. I just don't have time to mess with this right now. It would be great if these changes could be made to the installer though.

coreybutler commented 5 years ago

Thanks for this. I am pressed for time too, but if someone wants to take a shot at this, I'd accept a PR.

noelhibbard commented 5 years ago

I will try to get to over the weekend sometime.

noelhibbard commented 5 years ago

I created a pull request here: https://github.com/coreybutler/nvm-windows/pull/459

mcgwiz commented 8 months ago

459 was merged. Should this be closed?

coreybutler commented 8 months ago

@mcgwiz yes. Thanks for pointing that out.