Skip to content

Commit

Permalink
Reworked Launch Option Parsing to ignore First Element
Browse files Browse the repository at this point in the history
  • Loading branch information
HerpDerpinstine committed Nov 5, 2024
1 parent 9e31cfc commit 769ed03
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions MelonLoader/MelonLaunchOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ static MelonLaunchOptions()

internal static void Load()
{
LemonEnumerator<string> argEnumerator = new LemonEnumerator<string>(CommandLineArgs);
while (argEnumerator.MoveNext())
string[] args = CommandLineArgs;
int maxLen = args.Length;
for (int i = 1; i < maxLen; i++)
{
string fullcmd = argEnumerator.Current;
string fullcmd = args[i];
if (string.IsNullOrEmpty(fullcmd))
continue;

Expand Down Expand Up @@ -79,7 +80,7 @@ internal static void Load()
cmdArg = split[1];
}
if ((string.IsNullOrEmpty(cmdArg)
&& !argEnumerator.Peek(out cmdArg))
&& ((i + 1) > (maxLen - 1)))
|| string.IsNullOrEmpty(cmdArg)
|| !cmdArg.StartsWith("--")
|| !cmdArg.StartsWith("-"))
Expand Down

0 comments on commit 769ed03

Please sign in to comment.