- const wxChar* extension = NULL;
-
- //=== Adding the correct extension >>=================================
-
- m_filterIndex = (int)of.nFilterIndex - 1;
-
- if ( !of.nFileExtension || (of.nFileExtension && fileNameBuffer[ of.nFileExtension-1] != wxT('.')) )
- { // user has typed an filename
- // without an extension:
-
- int maxFilter = (int)(of.nFilterIndex*2L-1L);
- extension = filterBuffer;
-
- for( int i = 0; i < maxFilter; i++ ) { // get extension
- extension = extension + wxStrlen( extension ) +1;
- }
-
- extension = wxStrrchr( extension, wxT('.') );
- if ( extension // != "blabla"
- && !wxStrrchr( extension, wxT('*') ) // != "blabla.*"
- && !wxStrrchr( extension, wxT('?') ) // != "blabla.?"
- && extension[1] // != "blabla."
- && extension[1] != wxT(' ') ) // != "blabla. "
- {
- // now concat extension to the fileName:
- m_fileName = wxString(fileNameBuffer) + extension;
-
- int len = wxStrlen( fileNameBuffer );
- wxStrncpy( fileNameBuffer + len, extension, MAXPATH - len );
- fileNameBuffer[ MAXPATH -1 ] = wxT('\0');
- }
- }
-
- m_path = fileNameBuffer;
- m_fileName = wxFileNameFromPath(fileNameBuffer);
- m_fileNames.Add(m_fileName);
- m_dir = wxPathOnly(fileNameBuffer);