[commit] r2638 - in trunk/GME: Mga XmlBackEnd

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Fri Jun 17 14:36:06 CDT 2016


Author: ksmyth
Date: Fri Jun 17 14:36:06 2016
New Revision: 2638

Log:
Remove XML project if import fails

Modified:
   trunk/GME/Mga/MgaProject.cpp
   trunk/GME/XmlBackEnd/CoreXmlFile.cpp

Modified: trunk/GME/Mga/MgaProject.cpp
==============================================================================
--- trunk/GME/Mga/MgaProject.cpp	Fri Jun 17 14:36:02 2016	(r2637)
+++ trunk/GME/Mga/MgaProject.cpp	Fri Jun 17 14:36:06 2016	(r2638)
@@ -253,8 +253,10 @@
 	COMCATCH(
 		opened = CLOSED;
 		guidstat = CLEAN;
-		if (dataproject)
+		if (dataproject) {
 			dataproject->CloseProject(VARIANT_TRUE);
+			dataproject->DeleteProject(projectname);
+		}
 		if (metapr)
 			metapr->Close();
 		metapr = 0;

Modified: trunk/GME/XmlBackEnd/CoreXmlFile.cpp
==============================================================================
--- trunk/GME/XmlBackEnd/CoreXmlFile.cpp	Fri Jun 17 14:36:02 2016	(r2637)
+++ trunk/GME/XmlBackEnd/CoreXmlFile.cpp	Fri Jun 17 14:36:06 2016	(r2638)
@@ -1755,6 +1755,8 @@
 		if( m_sourceControl != SC_NONE )
 		checkInAll();*/
 
+		// FIXME Delete if Creat was no successful?
+
 		// purge my protect list
 		m_protectList.onLoad();
 
@@ -1768,8 +1770,23 @@
 }
 
 STDMETHODIMP CCoreXmlFile::DeleteProject()
-{ 
-	return E_NOTIMPL;
+{
+	TCHAR dir[MAX_PATH + 1];
+	_tcscpy(dir, m_folderPath.c_str());
+	dir[m_folderPath.length()] = L'\0';
+
+	SHFILEOPSTRUCT file_op = {
+        NULL,
+        FO_DELETE,
+        dir,
+        "",
+        FOF_NOCONFIRMATION |
+        FOF_NOERRORUI |
+        FOF_SILENT,
+        false,
+        0,
+        "" };
+	return SHFileOperation(&file_op) ? E_FAIL : S_OK;
 }
 
 STDMETHODIMP CCoreXmlFile::BeginTransaction()


More information about the gme-commit mailing list