From 4f1d0809ded3063edab15b4d5f5d3039454e36d5 Mon Sep 17 00:00:00 2001 From: nu774 Date: Thu, 17 Sep 2020 22:45:48 +0900 Subject: [PATCH] support new CoreAudioToolbox location --- main.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/main.cpp b/main.cpp index 8aadc1d..65db8cf 100644 --- a/main.cpp +++ b/main.cpp @@ -869,16 +869,22 @@ void set_dll_directories(int verbose) try { HKEY hKey; - const wchar_t *subkey = - L"SOFTWARE\\Apple Inc.\\Apple Application Support"; - HR(RegOpenKeyExW(HKEY_LOCAL_MACHINE, subkey, 0, KEY_READ, &hKey)); - std::shared_ptr hKeyPtr(hKey, RegCloseKey); - DWORD size; - HR(RegQueryValueExW(hKey, L"InstallDir", 0, 0, 0, &size)); - std::vector vec(size/sizeof(wchar_t)); - HR(RegQueryValueExW(hKey, L"InstallDir", 0, 0, - reinterpret_cast(&vec[0]), &size)); - searchPaths = strutil::format(L"%s;%s", &vec[0], searchPaths.c_str()); + const wchar_t *subkey[] = { + L"SOFTWARE\\Apple Inc.\\Apple Application Support", + L"SOFTWARE\\Apple Computer, Inc.\\iTunes", + }; + for (int i = 0; i < 2; ++i) { + if (!RegOpenKeyExW(HKEY_LOCAL_MACHINE, subkey[i], 0, KEY_READ, &hKey)) { + std::shared_ptr hKeyPtr(hKey, RegCloseKey); + DWORD size; + if (!RegQueryValueExW(hKey, L"InstallDir", 0, 0, 0, &size)) { + std::vector vec(size/sizeof(wchar_t)); + RegQueryValueExW(hKey, L"InstallDir", 0, 0, + reinterpret_cast(&vec[0]), &size); + searchPaths = strutil::format(L"%s;%s", &vec[0], searchPaths.c_str()); + } + } + } } catch (const std::exception &) {} std::wstring dir = win32::get_module_directory() + L"QTfiles"; #ifdef _WIN64