From d55f4d05b46a719f670467c28ea8f995ef4e3b67 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 6 Sep 2019 17:19:46 +0100 Subject: [PATCH] Workaround wxWidgets inability to find the default PDF viewer. Fixes: lp:1843061 * https://bugs.launchpad.net/kicad/+bug/1843061 --- common/gestfich.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/common/gestfich.cpp b/common/gestfich.cpp index 1280aecbda..593d318186 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -211,27 +211,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; } @@ -269,8 +269,6 @@ void OpenFile( const wxString& file ) if( !command.IsEmpty() ) ProcessExecute( command ); - - DisplayError( NULL, wxString::Format( _( "Cannot print '%s'.\n\nUnknown filetype." ), file ) ); } @@ -339,6 +337,7 @@ bool doPrintFile( const wxString& file, bool aDryRun ) } #endif + DisplayError( NULL, wxString::Format( _( "Cannot print '%s'.\n\nUnknown filetype." ), file ) ); return false; }