Skip to content

Commit 507277a

Browse files
authored
忽略 %ProgramFiles%\Common Files\Oracle\Java 中的 Java (#9)
1 parent 055805d commit 507277a

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

HMCL/java.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,15 @@ void HLSearchJavaInPath(HLJavaList &result, const std::wstring &path, LPCWSTR ja
188188
if (pathCount > 0) { // Not empty
189189
HLPath javaExecutable = path.substr(pos, pathCount);
190190
javaExecutable /= javaExecutableName;
191-
HLDebugLogVerbose(L"Checking " + javaExecutable.path);
192-
result.TryAdd(javaExecutable);
193-
}
194191

192+
// https://github.com/HMCL-dev/HMCL/issues/4079
193+
if (javaExecutable.path.find(L"\\Common Files\\Oracle\\Java\\") == std::wstring::npos) {
194+
HLDebugLogVerbose(L"Checking " + javaExecutable.path);
195+
result.TryAdd(javaExecutable);
196+
} else {
197+
HLDebugLogVerbose(std::format(L"Ignore Oracle Java {}", javaExecutable.path));
198+
}
199+
}
195200
pos = end + 1;
196201
}
197202
}

0 commit comments

Comments
 (0)