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

Detect invalid TShock installations #2882

Conversation

drunderscore
Copy link
Contributor

The grammar introduced in this PR is meant to be nit-picked! Please suggest what sounds most natural and understandable to an end-user.

Additionally, because we are in TShockLauncher and not in TShock yet, we cannot translate strings... and an error like this would benefit greatly from such. It may be worthwhile to hardcode some translations?

@drunderscore drunderscore force-pushed the feature/detect-installations-in-client-directory branch from d1ebbd6 to a86f18c Compare December 21, 2022 02:49
@hakusaro
Copy link
Member

Thanks! You've saved @CEO-Chair's bacon!

TShockLauncher/Program.cs Outdated Show resolved Hide resolved
@drunderscore drunderscore force-pushed the feature/detect-installations-in-client-directory branch from a86f18c to 7eccd72 Compare December 21, 2022 03:21
There are two common mistakes made by those installing/updating TShock:
- Extracting TShock into the Terraria client directory
- Extracting TShock 5 or newer into a legacy (TShock 4 or older) install

By checking for the existence of a file named `TerrariaServer.exe`, we
can potentially detect these invalid installations, and prompt the user
with a more useful diagnostic, rather than (likely) crashing moments
later.
@drunderscore drunderscore force-pushed the feature/detect-installations-in-client-directory branch from 7eccd72 to 3776baa Compare December 21, 2022 03:41
@drunderscore drunderscore changed the title Detect invalid installations in a Terraria client directory Detect invalid TShock installations Dec 21, 2022
// On occasion, users have been seen extracting TShock into their client installation directory -- this is of course incorrect, and is known
// to cause issues. Let's attempt to catch this before anything happens (specifically, before Terraria assemblies are resolved) and prevent
// TShock from launching.
if (File.Exists("TerrariaServer.exe"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅 I forgot to mention the .exe part is windows-specific. should it take into account other OSes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the exe part is not windows-specific, it also exists on Linux... and I'd assume Mac

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least vanilla and TShock 4 are both using Mono - and they are just regular assembly and extension doesn't matters much. This doesn't work for tModLoader, but who would do that tho?

@hakusaro
Copy link
Member

I think I would check for Content instead of a platform-specific binary, personally. But I'd check for something inside Content too?

@hakusaro hakusaro enabled auto-merge January 27, 2025 12:56
@hakusaro hakusaro merged commit 80c29ee into Pryaxis:general-devel Jan 27, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants