X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7482b22003c03f7aa3335aec271b5fcb48e2693d..7214297d16aed4c160c1cbef6b19f153ca065ab7:/src/msw/filedlg.cpp diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index b302e60220..cf53ed8159 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -106,8 +106,8 @@ wxString wxFileSelector(const char *title, if( i-is-1 > 0 && is+1 < filter2.Len() ) { -// if( filter2.Mid(is+1,i-is-1).Contains(defaultExtension) ) - if( filter2.Mid(is+1,i-is-1) == defaultExtension ) + if( filter2.Mid(is+1,i-is-1).Contains(defaultExtension) ) +// if( filter2.Mid(is+1,i-is-1) == defaultExtension ) { filterFind = filterIndex; break; @@ -222,12 +222,19 @@ int wxFileDialog::ShowModal(void) of.lpstrFileTitle = titleBuffer; of.nMaxFileTitle = MAXFILE + 1 + MAXEXT; // Windows 3.0 and 3.1 + // Convert forward slashes to backslashes (file selector doesn't like + // forward slashes) + size_t i = 0; + size_t len = m_dir.Length(); + for (i = 0; i < len; i++) + if (m_dir[i] == '/') + m_dir[i] = '\\'; + of.lpstrInitialDir = (const char *) m_dir; of.Flags = msw_flags; - //=== Like Alejandro Sierra's wildcard modification >>=================== /* In wxFileSelector you can put, instead of a single wild_card, @@ -241,7 +248,11 @@ int wxFileDialog::ShowModal(void) */ //======================================================================= - wxString theFilter = ( Strlen(m_wildCard) == 0 ) ? wxString("*.*") : m_wildCard; + wxString theFilter; + if ( Strlen(m_wildCard) == 0 ) + theFilter = wxString("*.*"); + else + theFilter = m_wildCard ; wxString filterBuffer; if ( !strchr( theFilter, '|' ) ) { // only one filter ==> default text @@ -251,10 +262,13 @@ int wxFileDialog::ShowModal(void) else { // more then one filter filterBuffer = theFilter; - for ( unsigned int i = 0; i < filterBuffer.Len(); i++ ) { - if ( filterBuffer.GetChar(i) == '|' ) { - filterBuffer[i] = '\0'; - } + } + + filterBuffer += "|"; + // Replace | with \0 + for (i = 0; i < filterBuffer.Len(); i++ ) { + if ( filterBuffer.GetChar(i) == '|' ) { + filterBuffer[i] = '\0'; } }