Portable way of opening URLs and directories (#156)

Replaced every instance of ShellExecute with wxLaunchDefaultBrowser
This commit is contained in:
bitscher 2022-09-03 13:32:31 -07:00 committed by GitHub
parent f3c70e69b4
commit 1a1de370e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 67 deletions

View file

@ -20,9 +20,6 @@
#include "../wxHelper.h"
#include <functional>
#ifdef _WIN32
#include <shellapi.h>
#endif
#include "config/ActiveSettings.h"
#include "gui/ChecksumTool.h"
@ -853,14 +850,10 @@ void wxTitleManagerList::OnContextMenuSelected(wxCommandEvent& event)
switch (event.GetId())
{
case kContextMenuOpenDirectory:
{
const auto path = fs::is_directory(entry->path) ? entry->path : entry->path.parent_path();
#ifdef _WIN32
ShellExecuteW(GetHWND(), L"open", path.generic_wstring().c_str(), nullptr, nullptr, SW_SHOWNORMAL);
#else
assert_dbg();
#endif
}
{
const auto path = fs::is_directory(entry->path) ? entry->path : entry->path.parent_path();
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(path)));
}
break;
case kContextMenuDelete:
m_context_worker = std::async(std::launch::async, &wxTitleManagerList::DeleteEntry, this, selection, entry.value());