[commit] r2291 - trunk/GME/Gme

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Fri Aug 16 10:48:56 CDT 2013


Author: ksmyth
Date: Fri Aug 16 10:48:55 2013
New Revision: 2291

Log:
Fix bug with importing files filename.xml.xme then trying to save an mga called filename.xml

Modified:
   trunk/GME/Gme/MgaOpenDlg.cpp

Modified: trunk/GME/Gme/MgaOpenDlg.cpp
==============================================================================
--- trunk/GME/Gme/MgaOpenDlg.cpp	Fri Aug 16 10:48:37 2013	(r2290)
+++ trunk/GME/Gme/MgaOpenDlg.cpp	Fri Aug 16 10:48:55 2013	(r2291)
@@ -98,8 +98,6 @@
 
 CString CMgaOpenDlg::AskMGAConnectionString()
 {
-	CString filters = mgaonlyfilter;
-
 	CString file, dir;
 	if (theApp.isMgaProj() && theApp.mgaProject)
 	{
@@ -108,8 +106,7 @@
 
 	CString conn;
 	CFileDialog dlg(flag_isopen ? TRUE : FALSE, _T("mga"), (file == _T("")) ? NULL : (LPCTSTR)file, 
-			OFN_EXPLORER | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | 
-			0, filters);
+			OFN_EXPLORER | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, mgaonlyfilter);
 
 	if (dir != _T(""))
 		dlg.GetOFN().lpstrInitialDir = dir;
@@ -130,9 +127,18 @@
 		{
 			if (openFileDialog || m_radio == 0)
 			{
+				const TCHAR* filter;
+				if (allowXme == false && openFileDialog == false)
+				{
+					filter = mgaonlyfilter;
+				}
+				else
+				{
+					filter = allowXme ? xmemgafilter : mgafilter;
+				}
 				CFileDialog dlg(openFileDialog, NULL, fileNameHint.IsEmpty() ? NULL : (LPCTSTR)fileNameHint,
 					OFN_EXPLORER | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT |
-					(flag_create ? 0 : OFN_FILEMUSTEXIST), allowXme ? xmemgafilter : mgafilter);
+					(flag_create ? 0 : OFN_FILEMUSTEXIST), filter);
 				if (!folderPathHint.IsEmpty())
 					dlg.m_ofn.lpstrInitialDir = folderPathHint.GetBuffer(_MAX_PATH);
 
@@ -141,6 +147,10 @@
 					CString ext = dlg.GetFileExt();
 					ext.MakeLower();
 
+					if (allowXme == false && openFileDialog == false)
+					{
+						return CString(L"MGA=") + dlg.GetPathName() + L".mga";
+					}
 					if( ext == _T("mga") || ext == _T("mta") )
 						conn = CString(_T("MGA=")) + dlg.GetPathName();
                     else if( ext == _T("mgx") )


More information about the gme-commit mailing list