Skip to content

Conversation

@vurvdev
Copy link
Contributor

@vurvdev vurvdev commented Dec 27, 2025

This adds a cross platform lua script to do the symlinking, it's only 200 lines of commented and typed lua code.
Should be cleaner to maintain than the powershell script.

Currently the windows implementation of a few things is left unimplemented (mklink, getSteamDir), so this doesn't remove the powershell script. It can be removed if someone accomplishes it in this PR.

@vurvdev
Copy link
Contributor Author

vurvdev commented Dec 27, 2025

Need to add all of the new paths the current script doesn't do.

Co-authored-by: Callum <35779365+callumok2004@users.noreply.github.com>
@artemking4
Copy link

Consider using https://luvit.io/ and its modules instead of relying on system executable utilities. The fs module includes methods for creating symlinks and other stuff. Cross-compatibility between platforms then comes at no cost.

@vurvdev
Copy link
Contributor Author

vurvdev commented Dec 27, 2025

Consider using https://luvit.io/ and its modules instead of relying on system executable utilities. The fs module includes methods for creating symlinks and other stuff. Cross-compatibility between platforms then comes at no cost.

It does come at the cost of convenience, going from needing any version of lua on your machine to needing a specialized version which isn't provided by any package manager atm.

I mean, all the work on the cross platform stuff is already done and won't need any changing to maintain it

@artemking4
Copy link

It's a single-liner installation process, though:

curl -L https://github.com/luvit/lit/raw/master/get-lit.sh | sh

Can also be installed locally, without getting into path or whatever. If that is not convenient, then im not sure what is.

Now, the reasoning behind this is simple: relying on stuff like popen is a very, very bad idea, and will come at a great cost for when you deal with lots of different setups. Moreover, are you sure that this script right there will not be just one of many? Are you sure it will not grow more and more as time flies? Are you sure you are passing arguments correctly, and that nothing will cause issues? The %q format was definitely not made for this, so please, refrain from this. Do not use abstraction layers where you do not need them, as its prone to bugs and vulnerabilities (well, not in this case, but you get it)

Another take on this is that, well, its easy to get lua on linux, yeah. But what about windows? Even the official website doesnt provide binaries. Do you expect people to find it themselves, or have it in the PATH already, or have a package manager like choco or similar already there?

Why all that if you can just use already proven things that can be installed with a single line of sh/powershell?

@vurvdev
Copy link
Contributor Author

vurvdev commented Dec 27, 2025

It's a single-liner installation process, though:

curl -L https://github.com/luvit/lit/raw/master/get-lit.sh | sh

Can also be installed locally, without getting into path or whatever. If that is not convenient, then im not sure what is.

Now, the reasoning behind this is simple: relying on stuff like popen is a very, very bad idea, and will come at a great cost for when you deal with lots of different setups. Moreover, are you sure that this script right there will not be just one of many? Are you sure it will not grow more and more as time flies? Are you sure you are passing arguments correctly, and that nothing will cause issues? The %q format was definitely not made for this, so please, refrain from this. Do not use abstraction layers where you do not need them, as its prone to bugs and vulnerabilities (well, not in this case, but you get it)

Another take on this is that, well, its easy to get lua on linux, yeah. But what about windows? Even the official website doesnt provide binaries. Do you expect people to find it themselves, or have it in the PATH already, or have a package manager like choco or similar already there?

Why all that if you can just use already proven things that can be installed with a single line of sh/powershell?

I don't see the issue with popen but it can be avoided if a real reason arises.

Lua and LuaJIT are available on winget. winget install "Lua for Windows"

I don't see an issue with %q at all. It serves its purpose barring newlines and regardless this isn't going to be taking user input.

Of course, if we want maximum convenience we can just make the script itself in C#. Worse dx to write it since the vdf parser is so ridiculously simple in lua but you need C# for the project anyway.

One downside of luvit beyond needing to download a whole specialized lua runtime for a script you'll run once is that you won't get typings outside of any ide beyond vscode so it becomes more of a pain to work on.

@artemking4
Copy link

One downside of luvit beyond needing to download a whole specialized lua runtime for a script you'll run once is that you won't get typings outside of any ide beyond vscode so it becomes more of a pain to work on.

But you do? Just use the LuaCATS language server with the luvit meta.

@vurvdev
Copy link
Contributor Author

vurvdev commented Dec 27, 2025

One downside of luvit beyond needing to download a whole specialized lua runtime for a script you'll run once is that you won't get typings outside of any ide beyond vscode so it becomes more of a pain to work on.

But you do? Just use the LuaCATS language server with the luvit meta.

Note the "beyond vscode". LuaLS has a vscode addon manager ui but I don't think there's any decent way to manage dependency typings for any other editors

@artemking4
Copy link

One downside of luvit beyond needing to download a whole specialized lua runtime for a script you'll run once is that you won't get typings outside of any ide beyond vscode so it becomes more of a pain to work on.

But you do? Just use the LuaCATS language server with the luvit meta.

Note the "beyond vscode". LuaLS has a vscode addon manager ui but I don't think there's any decent way to manage dependency typings for any other editors

Why assume that?
https://luals.github.io/wiki/addons/#installing-addons

@vurvdev
Copy link
Contributor Author

vurvdev commented Dec 27, 2025

One downside of luvit beyond needing to download a whole specialized lua runtime for a script you'll run once is that you won't get typings outside of any ide beyond vscode so it becomes more of a pain to work on.

But you do? Just use the LuaCATS language server with the luvit meta.

Note the "beyond vscode". LuaLS has a vscode addon manager ui but I don't think there's any decent way to manage dependency typings for any other editors

Why assume that? https://luals.github.io/wiki/addons/#installing-addons

That link kind of supports what I said? I don't think most people would define

  1. Having to know what LuaLS is in the first place
  2. Having to know where the LuaLS registry is
  3. Figuring out how to download a single folder from the repo
  4. Figuring out what setting you change to enable that addon

as a "decent way to manage dependency typings"

@artemking4
Copy link

I'd assume people who run editors other than vscode are used to things like that lol

@marchc1
Copy link
Owner

marchc1 commented Jan 2, 2026

@artemking4 @vurvdev My personal thoughts on this are that I agree with Vurv's take on wanting something thats easier for anyone to set up. It should be as easy as possible. However Artem's concerns about popen I could see potentially being valid (or at least I trust his concerns on it).

I think I like what Vurv brought up about using C# for this, especially given you can run .cs files with .NET 10. The user has to have the .NET 10 SDK anyway to build the project, let alone use it right now, so I don't see a reason not to do it like this and get rid of the Powershell/Lua stuff altogether.

This would be really easy to set up, I already have the logic for getting Steam directories on all three major platforms (Windows, OSX, Linux) for a separate project, so I could take all that stuff and turn it into a single script for this.

@vurvdev
Copy link
Contributor Author

vurvdev commented Jan 2, 2026

@artemking4 @vurvdev My personal thoughts on this are that I agree with Vurv's take on wanting something thats easier for anyone to set up. It should be as easy as possible. However Artem's concerns about popen I could see potentially being valid (or at least I trust his concerns on it).

I think I like what Vurv brought up about using C# for this, especially given you can run .cs files with .NET 10. The user has to have the .NET 10 SDK anyway to build the project, let alone use it right now, so I don't see a reason not to do it like this and get rid of the Powershell/Lua stuff altogether.

This would be really easy to set up, I already have the logic for getting Steam directories on all three major platforms (Windows, OSX, Linux) for a separate project, so I could take all that stuff and turn it into a single script for this.

Yeah a C# script would probably be ideal but idk how simple you could make it for the vdf parsing stuff. Cutting out the lua boilerplate for fs operations would be nice

@artemking4
Copy link

I think I like what Vurv brought up about using C# for this, especially given you can run .cs files with .NET 10. The user has to have the .NET 10 SDK anyway to build the project, let alone use it right now, so I don't see a reason not to do it like this and get rid of the Powershell/Lua stuff altogether.

I agree there, indeed. This way you dont have to rely on something like that and can also use things from source.net directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants