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

Windows Installer: automatically set path (for new programmer) #8870

Closed
uvtc opened this issue Oct 9, 2019 · 13 comments
Closed

Windows Installer: automatically set path (for new programmer) #8870

uvtc opened this issue Oct 9, 2019 · 13 comments
Milestone

Comments

@uvtc
Copy link
Contributor

@uvtc uvtc commented Oct 9, 2019

Some background first, thanks for bearing with me.

I wanted to help an acquaintance get started learning programming (with Haxe as their first language). They are completely new to programming. They have access to an MS Windows machine (they have an account), but no admin access.

I thought the easiest path forward would be to use Haxe's Python target. (They don't need performance --- they just need a programming environment installed and working in the easiest way possible.)

I downloaded and installed Python 3.7.4. I have not used MS Windows for programming in years. I ran the Python installer, and it gave me a choice to install Python on the system or else locally (since I don't have admin access on this particular machine, I went for the local install, and it worked). It also gave me the choice of adding python to whatever MS Windows uses for its $PATH, and I opted to do so; and after opening what passes as a console on MS Windows (cmd), was able to run python and the prompt came up. Nice.

Upon then installing Haxe, I was asked here as well where to install, and I don't think there was a default local location so I opted for c:/users/me/dev or somesuch. The installation completed, but when I opened up cmd it could not find the haxe executable.

To make it as easy as possible for new users to get started using Haxe on a MS Windows machine, I think it would be most helpful if the installer could set the path (like how the Python installer does) so that cmd can find the haxe compiler after installation completes. (Would it also have to set HAXE_STD_PATH so haxe can find its std lib?).

@RealyUniqueName

This comment has been minimized.

Copy link
Member

@RealyUniqueName RealyUniqueName commented Oct 10, 2019

I thought windows installer already adds Haxe to PATH.
Could it be that windows needs a reboot for that change to take effect?

@RealyUniqueName RealyUniqueName added this to the Release 4.1 milestone Oct 10, 2019
@Simn

This comment has been minimized.

Copy link
Member

@Simn Simn commented Oct 10, 2019

It does set the PATH, and you don't have to reboot.

Are you sure you opened cmd after installing? Changes to environment variables do not affect already open instances.

@uvtc

This comment has been minimized.

Copy link
Contributor Author

@uvtc uvtc commented Oct 10, 2019

Closed and re-opened cmd, but it still can't find haxe.

Rebooted as well. No joy.

Opened up "Advanced System Settings" --> Environment Variables, and there's a PATH in there (for me as a local user) with a bunch of Python additions, but nothing for Haxe.

This is a MS Windows 7 Pro PC. When I boot up the machine and log in I think it pulls my home directory (or whatever MS calls it) from a network drive.

When I installed Haxe I specified that it go into c:/Users/my.name/opt.

@uvtc

This comment has been minimized.

Copy link
Contributor Author

@uvtc uvtc commented Oct 10, 2019

The installer appeared to complete normally and successfully.

@Simn

This comment has been minimized.

Copy link
Member

@Simn Simn commented Oct 29, 2019

The related installer code hasn't changed in years and has been working fine, so I can only assume that this is some problem that is specific to the user's setup. Maybe some access restrictions, Windows tends to be interesting in that regard.

For reference, the code being used for this comes from this little C snippet: https://github.com/HaxeFoundation/haxe/blob/development/extra/setup.cpp

This is generated as haxesetup.exe and executed during installation. Maybe try running that executable manually and see if it does anything.

The reason we're using this is because at the time, NSIS had some bug which would wipe your PATH if it got too long.

@ncannasse

This comment has been minimized.

Copy link
Member

@ncannasse ncannasse commented Oct 29, 2019

Instead of doing haxesetup.exe, it is now possible to set environment variable on windows using the setx command: setx MYVAR value

@Simn

This comment has been minimized.

Copy link
Member

@Simn Simn commented Nov 4, 2019

I feel like trying to do this in a patch release would lead to 10 more patch releases that fix the emerging problems...

@RealyUniqueName

This comment has been minimized.

Copy link
Member

@RealyUniqueName RealyUniqueName commented Nov 26, 2019

@uvtc
Could you please check if this solves the issue for you? #8990
If not, then maybe the fact that your user profile is loaded from a net disk is the reason. Probably in this case our installer should change PATH in HKCU registry instead of HKLM.

@RealyUniqueName

This comment has been minimized.

Copy link
Member

@RealyUniqueName RealyUniqueName commented Nov 26, 2019

Right. HKEY_LOCAL_MACHINE modification requires admin access, so haxesetup.exe failed to modify it since you don't have admin privileges.

@uvtc

This comment has been minimized.

Copy link
Contributor Author

@uvtc uvtc commented Nov 26, 2019

Ok. Note, I'm not familiar with MS Windows cmd, so I'm not going to try to do setx. I also don't have regular access to an MS Windows machine. This is for an acquaintance on a Windows machine that they sometimes use. I do not have admin access on this machine.

I've previously removed the installation by running the uninstaller app.

I just downloaded the 4.0.2 Windows 64-bit installer. Installed into c:/Users/me/opt. Installer seemed to finish fine. Opened up cmd but haxe is not recognized as a command.

Right. HKEY_LOCAL_MACHINE modification requires admin access, so haxesetup.exe failed to modify it since you don't have admin privileges.

Ok. Hope this report was useful. I still don't understand why the Python installer worked (for this local install) but Haxe's did not. It looks like the Python installer installed into c:/Users/me/AppData/Local .

@RealyUniqueName

This comment has been minimized.

Copy link
Member

@RealyUniqueName RealyUniqueName commented Nov 26, 2019

@uvtc

This comment has been minimized.

Copy link
Contributor Author

@uvtc uvtc commented Nov 27, 2019

By the way, before even trying that newer build, upon uninstalling the one I just installed, I get a note in the uninstaller that says, "Target was NOT found in PATH (nothing to remove)", with a popup dialog that says, "Could not write updated PATH to HKLM".

@uvtc

This comment has been minimized.

Copy link
Contributor Author

@uvtc uvtc commented Nov 27, 2019

Tried that new build. Works now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.