elenakrittik / gdtk

A versatile Godot toolkit with aim on speed, extensibility and friendliness.
5 stars 2 forks source link

Make it possible to invoke the global Godot installation as `godot` on Windows. #158

Open elenakrittik opened 1 month ago

elenakrittik commented 1 month ago

Currently, you have to use godot.lnk (.lnk meaning "link", or in Windows terms - shortcut). This is necessary because Windows runs symlinks with the current directory set to the symlink's directory, not the symlink's target's directory, which results in a crash for mono installation because Godot can't find GodotSharp in ~/.local/bin).

The only solution i see is to ship a platform-specific script (likely cmd or a native binary (for Windows, since only it is affected)) that will simply run gdtk godot run default, similar to what Scoop does with it's "shims".

devklick commented 1 month ago

Do you plan for the godot.lnk shortcut to be executed via CLI by your users to open Godot, and you want to give them the option to invoke just godot instead?

If so, and if you are planning to create some kind of installer script for gdtk, you could potentially alter the PATHEXT environment variable to include .lnk files, which would allow the shortcut to be invoked without having to specify the extension. Example on SO.

I've manually set this on my test VM and it works fine, so I expect it can be done via script.

I'm not how users would feel about your installer altering this environment variable, however. While most users probably wouldnt care, some might find it quite intrusive.

elenakrittik commented 1 month ago

Do you plan for the godot.lnk shortcut to be executed via CLI by your users to open Godot, and you want to give them the option to invoke just godot instead?

If so, and if you are planning to create some kind of installer script for gdtk, you could potentially alter the PATHEXT environment variable to include .lnk files, which would allow the shortcut to be invoked without having to specify the extension. Example on SO.

Wow, that's super useful, thanks! My main aim with exposing a global godot executable is to make tools like the GDScript VSCode extension work. (The extension requires a Godot binary to work, and it's hardly convenient to set up the binary path manually.) Allowing the user to type godot instead of gdtk godot run happens to come as a nice bonus.

I'm not how users would feel about your installer altering this environment variable, however. While most users probably wouldnt care, some might find it quite intrusive.

I think a good way would be to check PATHEXT when setting up the global Godot version and if doesn't include .lnk, print out a warning with a command that the user can run to add .lnk to PATHEXT.