(GetProcAddress(shell32_base, "SHOpenFolderAndSelectItems"));
}
if (!open_folder_and_select_itemsPtr) {
- ShellExecute(NULL, L"open", dir.value().c_str(), NULL, NULL, SW_SHOW);
+ ui::win::OpenFolderViaShell(dir);
return;
}
hr = desktop->ParseDisplayName(NULL, NULL,
const_cast<wchar_t *>(dir.value().c_str()),
NULL, &dir_item, NULL);
- if (FAILED(hr))
+ if (FAILED(hr)) {
+ ui::win::OpenFolderViaShell(dir);
return;
+ }
base::win::ScopedCoMem<ITEMIDLIST> file_item;
hr = desktop->ParseDisplayName(NULL, NULL,
const_cast<wchar_t *>(full_path.value().c_str()),
NULL, &file_item, NULL);
- if (FAILED(hr))
+ if (FAILED(hr)) {
+ ui::win::OpenFolderViaShell(dir);
return;
+ }
const ITEMIDLIST* highlight[] = { file_item };
// found" even though the file is there. In these cases, ShellExecute()
// seems to work as a fallback (although it won't select the file).
if (hr == ERROR_FILE_NOT_FOUND) {
- ShellExecute(NULL, L"open", dir.value().c_str(), NULL, NULL, SW_SHOW);
+ ui::win::OpenFolderViaShell(dir);
} else {
LPTSTR message = NULL;
DWORD message_length = FormatMessage(
<< " " << reinterpret_cast<LPTSTR>(&message);
if (message)
LocalFree(message);
+
+ ui::win::OpenFolderViaShell(dir);
}
}
}