From: Vadim Zeitlin Date: Mon, 15 Jan 2001 18:01:28 +0000 (+0000) Subject: fixed a bug in handling mailcap entries with more than one commands with tests X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c93d67707fb3683f8b54449a5692bcf7e2e5a0e1 fixed a bug in handling mailcap entries with more than one commands with tests git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9093 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index 573747fe13..b8cc5ea5b7 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -910,24 +910,27 @@ wxFileTypeImpl::GetEntry(const wxFileType::MessageParameters& params) const wxString command; MailCapEntry *entry = m_manager->m_aEntries[m_index[0]]; while ( entry != NULL ) { - // notice that an empty command would always succeed (it's ok) + // get the command to run as the test for this entry command = wxFileType::ExpandCommand(entry->GetTestCmd(), params); - // suppress the command output - if ( !command.IsEmpty() ) + // don't trace the test result if there is no test at all + if ( command.IsEmpty() ) { - if ( wxSystem(command) == 0 ) { - // ok, passed - wxLogTrace(TRACE_MIME, - wxT("Test '%s' for mime type '%s' succeeded."), - command.c_str(), params.GetMimeType().c_str()); - break; - } - else { - wxLogTrace(TRACE_MIME, - wxT("Test '%s' for mime type '%s' failed."), - command.c_str(), params.GetMimeType().c_str()); - } + // no test at all, ok + break; + } + + if ( wxSystem(command) == 0 ) { + // ok, test passed + wxLogTrace(TRACE_MIME, + wxT("Test '%s' for mime type '%s' succeeded."), + command.c_str(), params.GetMimeType().c_str()); + break; + } + else { + wxLogTrace(TRACE_MIME, + wxT("Test '%s' for mime type '%s' failed."), + command.c_str(), params.GetMimeType().c_str()); } entry = entry->GetNext();