Skip to content

Commit 63aa2c7

Browse files
committed
feat: Allow the user to enter their own path if the app can't find the registry keys.
1 parent 031557e commit 63aa2c7

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

cf-java-gpu-fix/Program.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,36 @@ Right click me and use "Run as administrator"
4747
else
4848
{
4949
Log("Didn't find Overwolf/CurseForge.. anyhow..", LogLevel.Warning);
50+
51+
Log("Do you want to enter your own path? [Y/N]");
52+
var acceptedKeys = new[] { ConsoleKey.Y, ConsoleKey.N };
53+
ConsoleKey key;
54+
do
55+
{
56+
key = Console.ReadKey(true).Key;
57+
if (!acceptedKeys.Contains(key))
58+
{
59+
Log($"That was {key}, not Y or N, try again..", LogLevel.Error);
60+
}
61+
} while (!acceptedKeys.Contains(key));
62+
63+
if (key == ConsoleKey.N)
64+
{
65+
Log("Oh.. Ok, exiting! Bye!");
66+
return 0;
67+
}
68+
69+
Log("Enter the path of your modding folder from CurseForge/Overwolf");
70+
var path = Console.ReadLine();
71+
if (string.IsNullOrWhiteSpace(path))
72+
{
73+
Log("You didn't enter anything.. exiting..", LogLevel.Error);
74+
return -1;
75+
}
76+
77+
var cfJavaExecutables = GetJavaExecutablesFromPath(path, "javaw.exe");
78+
Log($"Found {cfJavaExecutables.Count} executables, adding to list");
79+
javaExecutables.AddRange(cfJavaExecutables.Select(j => j.FullName));
5080
}
5181

5282
if (javaExecutables.Count == 0)

0 commit comments

Comments
 (0)