From 30c016567fef14460867155d80bd9af05575af81 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sun, 11 Jan 2015 11:28:02 +0100 Subject: bugfix: first attempt at discovering java binary always failed --- src/mainwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 63598d27..6bb77a79 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4547,14 +4547,15 @@ int MainWindow::getBinaryExecuteInfo(const QFileInfo &targetInfo, QFileInfo &bin WCHAR buffer[MAX_PATH]; if (::FindExecutableW(targetPathW.c_str(), NULL, buffer) > (HINSTANCE)32) { DWORD binaryType = 0UL; - if (!::GetBinaryTypeW(targetPathW.c_str(), &binaryType)) { - qDebug("failed to determine binary type of \"%ls\": %lu", targetPathW.c_str(), ::GetLastError()); + if (!::GetBinaryTypeW(buffer, &binaryType)) { + qDebug("failed to determine binary type of \"%ls\": %lu", buffer, ::GetLastError()); } else if (binaryType == SCS_32BIT_BINARY) { binaryPath = ToQString(buffer); } } } if (binaryPath.isEmpty() && (extension == "jar")) { + // second attempt: look to the registry QSettings javaReg("HKEY_LOCAL_MACHINE\\Software\\JavaSoft\\Java Runtime Environment", QSettings::NativeFormat); if (javaReg.contains("CurrentVersion")) { QString currentVersion = javaReg.value("CurrentVersion").toString(); -- cgit v1.3.1