-// Generic file save dialog
-wxString wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
-{
- return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
-}
+ wxSplitPath( zFileNameBuffer
+ ,&m_path
+ ,&m_fileName
+ ,&sExt
+ );
+ if (zFileNameBuffer[nIdx] == wxT('.') || sExt.empty())
+ {
+ zFileNameBuffer[nIdx] = wxT('\0');
+
+ //
+ // User has typed a filename without an extension:
+ //
+ // A filename can end in a "." here ("abc."), this means it
+ // does not have an extension. Because later on a "." with
+ // the default extension is appended we remove the "." if
+ // filename ends with one (We don't want files called
+ // "abc..ext")
+ //
+ pzExtension = sFilterBuffer.c_str();
+
+ for( int i = 0; i < (int)sFilterBuffer.length(); i++ )
+ {
+ //
+ // Get extension
+ //
+ pzExtension = wxStrrchr(pzExtension, wxT('.'));
+ if ( pzExtension &&
+ !wxStrrchr(pzExtension, wxT('*')) &&
+ !wxStrrchr(pzExtension, wxT('?')) &&
+ pzExtension[1] &&
+ pzExtension[1] != wxT(' ')
+ ) // != "blabla. "
+ {
+ //
+ // Now concat extension to the fileName:
+ //
+ m_path = wxString(zFileNameBuffer) + pzExtension;
+ }
+ }
+ }
+ else
+ {
+ m_path = (wxChar*)vFileDlg.szFullFile;
+ }
+ m_fileName = wxFileNameFromPath((const wxChar*)vFileDlg.szFullFile);
+ m_dir = wxPathOnly((const wxChar*)vFileDlg.szFullFile);