Skip to content

Commit

Permalink
innosetup: check username doesn't end with exclamation mark
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam- committed Aug 31, 2023
1 parent 7ccb8a9 commit cf2a41f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
3 changes: 2 additions & 1 deletion innosetup/runelite.iss
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ Type: filesandordirs; Name: "{%USERPROFILE}\.runelite\repository2"
Type: filesandordirs; Name: "{app}"

[Code]
#include "upgrade.pas"
#include "upgrade.pas"
#include "usernamecheck.pas"
3 changes: 2 additions & 1 deletion innosetup/runelite32.iss
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ Type: filesandordirs; Name: "{%USERPROFILE}\.runelite\repository2"
Type: filesandordirs; Name: "{app}"

[Code]
#include "upgrade.pas"
#include "upgrade.pas"
#include "usernamecheck.pas"
3 changes: 2 additions & 1 deletion innosetup/runeliteaarch64.iss
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ Type: filesandordirs; Name: "{%USERPROFILE}\.runelite\repository2"
Type: filesandordirs; Name: "{app}"

[Code]
#include "upgrade.pas"
#include "upgrade.pas"
#include "usernamecheck.pas"
23 changes: 23 additions & 0 deletions innosetup/usernamecheck.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// https://stackoverflow.com/a/61522649
function EndsWith(SubText, Text: string): Boolean;
var
EndStr: string;
begin
EndStr := Copy(Text, Length(Text) - Length(SubText) + 1, Length(SubText));
{ Use SameStr, if you need a case-sensitive comparison }
Result := SameText(SubText, EndStr);
end;

function InitializeSetup(): Boolean;
var
username: String;
begin
username := GetUserNameString();
Result := True;
if EndsWith('!', username) then
begin
MsgBox('RuneLite is incompatible with Windows usernames which end with an exclamation mark (!).',
mbError, MB_OK);
Result := False;
end;
end;

0 comments on commit cf2a41f

Please sign in to comment.