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
This commit is contained in:
Vadim Zeitlin 2001-01-15 18:01:28 +00:00
parent ebf776c5b8
commit c93d67707f

View File

@ -910,24 +910,27 @@ wxFileTypeImpl::GetEntry(const wxFileType::MessageParameters& params) const
wxString command; wxString command;
MailCapEntry *entry = m_manager->m_aEntries[m_index[0]]; MailCapEntry *entry = m_manager->m_aEntries[m_index[0]];
while ( entry != NULL ) { 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); command = wxFileType::ExpandCommand(entry->GetTestCmd(), params);
// suppress the command output // don't trace the test result if there is no test at all
if ( !command.IsEmpty() ) if ( command.IsEmpty() )
{ {
if ( wxSystem(command) == 0 ) { // no test at all, ok
// ok, passed break;
wxLogTrace(TRACE_MIME, }
wxT("Test '%s' for mime type '%s' succeeded."),
command.c_str(), params.GetMimeType().c_str()); if ( wxSystem(command) == 0 ) {
break; // ok, test passed
} wxLogTrace(TRACE_MIME,
else { wxT("Test '%s' for mime type '%s' succeeded."),
wxLogTrace(TRACE_MIME, command.c_str(), params.GetMimeType().c_str());
wxT("Test '%s' for mime type '%s' failed."), break;
command.c_str(), params.GetMimeType().c_str()); }
} else {
wxLogTrace(TRACE_MIME,
wxT("Test '%s' for mime type '%s' failed."),
command.c_str(), params.GetMimeType().c_str());
} }
entry = entry->GetNext(); entry = entry->GetNext();