]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/filedlg.cpp
corrected warnings
[wxWidgets.git] / src / mac / carbon / filedlg.cpp
index 87e78461771bfc7b29dc74e96af6a86bf68a5539..cef71e0136877a01afbaf557c339758558c5a22f 100644 (file)
@@ -144,12 +144,16 @@ void MakeUserDataRec(OpenUserDataRec      *myData , const wxString& filter )
         current += filter2.GetChar(i) ;
        }
     }
-//    if ( filterIndex > 0 )
-    {
-      wxASSERT_MSG( !isName , "incorrect format of format string" ) ;
-      myData->extensions[filterIndex] = current.MakeUpper() ;
-      ++filterIndex ;
-    }
+    // we allow for compatibility reason to have a single filter expression (like *.*) without
+    // an explanatory text, in that case the first part is name and extension at the same time
+      
+    wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ;
+    if ( current.IsEmpty() )
+        myData->extensions[filterIndex] = myData->name[filterIndex] ;
+    else
+        myData->extensions[filterIndex] = current.MakeUpper() ;
+    ++filterIndex ;
+
 
                myData->numfilters = filterIndex ;
                for ( int i = 0 ; i < myData->numfilters ; i++ )
@@ -491,19 +495,17 @@ int wxFileDialog::ShowModal()
                                if (specDesc.dataHandle != nil) {
                                        ::AEDisposeDesc(&specDesc);
                                }
-
-                                                               
-                               // outFolderDirID = thePB.dirInfo.ioDrDirID;
                                m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
                                m_paths.Add( m_path ) ;
+                m_fileName = wxFileNameFromPath(m_path);
                    m_fileNames.Add(m_fileName);
-                }
-                // set these to the first hit
-                m_path = m_paths[ 0 ] ;
-                m_fileName = wxFileNameFromPath(m_path);
-                m_dir = wxPathOnly(m_path);
-       NavDisposeReply( &mNavReply ) ;
-                       return wxID_OK ;
+               }
+            // set these to the first hit
+            m_path = m_paths[ 0 ] ;
+            m_fileName = wxFileNameFromPath(m_path);
+            m_dir = wxPathOnly(m_path);
+            NavDisposeReply( &mNavReply ) ;
+           return wxID_OK ;
                }
                return wxID_CANCEL;
 }