Workaround wxWidgets inability to find the default PDF viewer.

Fixes: lp:1843061
* https://bugs.launchpad.net/kicad/+bug/1843061

(cherry picked from commit d55f4d05b4)
This commit is contained in:
Jeff Young 2019-09-06 17:19:46 +01:00
parent d5275b16aa
commit 75bb864237
1 changed files with 5 additions and 5 deletions

View File

@ -347,27 +347,27 @@ bool OpenPDF( const wxString& file )
wxString command;
wxString filename = file;
// Quote in case there are spaces in the file name.
AddDelimiterString( filename );
Pgm().ReadPdfBrowserInfos();
if( !Pgm().UseSystemPdfBrowser() ) // Run the preferred PDF Browser
{
command = Pgm().GetPdfBrowserName() + wxT( " " ) + filename;
command = Pgm().GetPdfBrowserName() + wxT( " '" ) + filename + wxT( "'" );
}
else
{
if( wxLaunchDefaultApplication( filename ) )
return true;
#ifdef __WXMAC__
command = wxT( "/usr/bin/open -a '" ) + filename + wxT( "'" );
#endif
// If launching the system default PDF viewer fails, fall through with empty command
// string so the error message is displayed.
}
if( !command.IsEmpty() )
{
if( ProcessExecute( command ) )
if( ProcessExecute( command ) != -1 )
{
return true;
}