marler8997 / zigup

Download and manage zig compilers.
MIT No Attribution
784 stars 61 forks source link

Show symlinks to compilers in `zigup list` #144

Open dweiller opened 4 months ago

dweiller commented 4 months ago

This PR makes zigup list include symlinks to compilers in the install directory display in the list of installed compilers. This is useful as it is possible to use these symlinks as the COMPILER_NAME in zigup default COMPILER_NAME. Currently the only symlink created by zigup is one for master, but this PR would also support a user who wants to make custom symlinks to name particular compilers.

This feature will be particularly helpful if/when mach nominated versions are supported (see #145), as all of the nominated versions should be referenced via a link.

marler8997 commented 2 months ago

I'm not sure exactly how to get into this state that's newly being handled here but it seems like a reasonable feature, would you mind adding a test for this in test.zig?

P.S. This might be helpful and/or a way to implement https://github.com/marler8997/zigup/issues/135 ?

dweiller commented 2 months ago

To help with an implementation of #135, the logic would want to be a bit different than what is currently implemented. At the moment I have (conservatively) chosen to not list links that resolve to paths outside the installation directory. For #135 (and maybe in general) we would want to list any symlink to a directory. This is simpler to do than the current implementation and allows for more use cases like #135 or linking to a local build of zig.

would you mind adding a test for this in test.zig?

Will do.

dweiller commented 2 months ago

I've simplified the logic as mentioned above. It looks like windows is handling the symlinks in an odd way (or at least unexpected to me) that will need some investigation.

marler8997 commented 1 month ago

Looks like windows is failing, I think there's a way to test if symlinks are supported you could use to disable the test in that case?