Fix path/URL confusion in wxLaunchDefaultBrowser()
Add a helper wxLaunchBrowserParams struct with clearly distinct "url" and "path" fields and GetPathOrURL() accessor which returns whichever is appropriate. This makes the code more clear and ensures that we never pass URLs (but only file paths) to xdg-open under Unix as it doesn't handle them. See #17227.
This commit is contained in:
@@ -36,6 +36,10 @@
|
||||
|
||||
#include <AudioToolbox/AudioServices.h>
|
||||
|
||||
#if wxUSE_GUI
|
||||
#include "wx/private/launchbrowser.h"
|
||||
#endif
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
#include "wx/osx/private/timer.h"
|
||||
|
||||
@@ -130,11 +134,10 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags)
|
||||
// Launch default browser
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxDoLaunchDefaultBrowser(const wxString& url, int flags)
|
||||
bool wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params)
|
||||
{
|
||||
wxUnusedVar(flags);
|
||||
wxCFRef< CFURLRef > curl( CFURLCreateWithString( kCFAllocatorDefault,
|
||||
wxCFStringRef( url ), NULL ) );
|
||||
wxCFStringRef( params.url ), NULL ) );
|
||||
OSStatus err = LSOpenCFURLRef( curl , NULL );
|
||||
|
||||
if (err == noErr)
|
||||
|
Reference in New Issue
Block a user