Skip to content

Commit

Permalink
feat: Allow the user to enter their own path if the app can't find th…
Browse files Browse the repository at this point in the history
…e registry keys.
  • Loading branch information
itssimple committed Jul 18, 2024
1 parent 031557e commit 63aa2c7
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions cf-java-gpu-fix/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,36 @@ Right click me and use "Run as administrator"
else
{
Log("Didn't find Overwolf/CurseForge.. anyhow..", LogLevel.Warning);

Log("Do you want to enter your own path? [Y/N]");
var acceptedKeys = new[] { ConsoleKey.Y, ConsoleKey.N };
ConsoleKey key;
do
{
key = Console.ReadKey(true).Key;
if (!acceptedKeys.Contains(key))
{
Log($"That was {key}, not Y or N, try again..", LogLevel.Error);
}
} while (!acceptedKeys.Contains(key));

if (key == ConsoleKey.N)
{
Log("Oh.. Ok, exiting! Bye!");
return 0;
}

Log("Enter the path of your modding folder from CurseForge/Overwolf");
var path = Console.ReadLine();
if (string.IsNullOrWhiteSpace(path))
{
Log("You didn't enter anything.. exiting..", LogLevel.Error);
return -1;
}

var cfJavaExecutables = GetJavaExecutablesFromPath(path, "javaw.exe");
Log($"Found {cfJavaExecutables.Count} executables, adding to list");
javaExecutables.AddRange(cfJavaExecutables.Select(j => j.FullName));
}

if (javaExecutables.Count == 0)
Expand Down

0 comments on commit 63aa2c7

Please sign in to comment.