(Windows) Update PATH as part of install?

Would it ever be possible to have the Windows installer update the system PATH variable to include the Racket program folder? (And, ideally, remove it again on uninstall.) This is the only really unfriendly part of setting up Racket on Windows.

I think it’s probably not feasible on Linux or Mac OS, but since there is only one place where PATH is managed in Windows, it seems like it should be possible in principle.

Not a conclusion, but an explanation of where things stand:

There's an option in DrRacket's "Help" menu for Windows and Mac OS to update PATH: "Configure Command Line for Racket...". Partly, that functionality in DrRacket because there's no installer program on Mac OS.

For Windows, I think it would make sense to add support to the installer, and I would probably have done that already if it were easy. Unfortunately, the installer that we use has issues with this task; see the top of Path Manipulation - NSIS. There's a plug-in to fix the problem, but I don't think think the plug-in will work on non-Windows machines where we run cross builds. And there's an example script linked from the NSIS docs to use Win32 functionality, but the license is GPL 2, which is a complication. If someone is interested enough to work out a solution that works for cross builds, I'd be happy to help merge it to the use of NSIS in the distro-build-client package.

1 Like

I wasn’t aware of this! I tried it on Windows just now under different scenarios and it works well. Even this much is helpful, because it means giving guidance to a new user is a lot simpler, even if there is an extra step involved.

There's a plug-in to fix the problem, but I don't think think the plug-in will work on non-Windows machines where we run cross builds. And there's an example script linked from the NSIS docs to use Win32 functionality, but the license is GPL 2, which is a complication. If someone is interested enough to work out a solution that works for cross builds, I'd be happy to help merge it to the use of NSIS in the distro-build-client package.

I see, yes, this is tricky. Thanks for pointing me in the right direction.

I emailed Christian Franke, the author of that script, and he explained that the AddToPath, RemoveFromPath, and StrStr functions in that script were all based originally on examples from the NSIS wiki (which it appears would have made them subject to the zlib/libpng license) and has no problem with us using those functions specifically under a more relaxed license.

To be clear, I know you have bigger fish to fry and am not expecting you to make use of this any time soon. I would also submit a PR; but it will be some time before I have a big-enough chunk of free time to delve into the package and figure out how to test my changes. Whether I eventually make the attempt or someone else does, at least we have what seems to me a feasible approach.

1 Like