[GME-commit] GMESRC/GME/XmlBackEnd CoreXmlFile.cpp, 1.29, 1.30 CoreXmlFile.h, 1.13, 1.14

Log messages of CVS commits gme-commit at list.isis.vanderbilt.edu
Tue Feb 19 17:39:11 CST 2008


Update of /project/gme-repository/GMESRC/GME/XmlBackEnd
In directory escher:/tmp/cvs-serv28732

Modified Files:
	CoreXmlFile.cpp CoreXmlFile.h 
Log Message:
Doing a 2nd attempt (by searching for .mgx files) when project files are not loaded/parsed successfully.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: CoreXmlFile.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/XmlBackEnd/CoreXmlFile.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** CoreXmlFile.cpp	19 Feb 2008 19:20:54 -0000	1.29
--- CoreXmlFile.cpp	19 Feb 2008 23:39:08 -0000	1.30
***************
*** 2131,2135 ****
  }
  
! void CCoreXmlFile::setFileNames()
  {  
  	char drive[_MAX_DRIVE];
--- 2131,2135 ----
  }
  
! void CCoreXmlFile::setFileNames( bool p_reset /* = false */)
  {  
  	char drive[_MAX_DRIVE];
***************
*** 2140,2143 ****
--- 2140,2176 ----
  	_splitpath( m_folderPath.c_str(), drive, dir, fname, ext );
  
+ 	if( p_reset)
+ 	{
+ 		// fname will be reset
+ 		
+ 		char                 buf[_MAX_PATH];
+ 		_finddata_t          fileInfo;
+ 
+ 		sprintf( buf, "%s\\*.mgx", m_folderPath.c_str() );
+ 
+ 		long searchHandle = _findfirst( buf, &fileInfo ); // findfirst
+ 		long ret = searchHandle;
+ 		long count = 0;
+ 		while( ret != -1 && ++count)
+ 			ret = _findnext( searchHandle, &fileInfo );   // findnext
+ 
+ 		if( count > 1)
+ 			sendMsg( "Multiple .mgx files found in directory " + m_folderPath, MSG_ERROR);
+ 		else if( count == 0)
+ 			sendMsg( "No .mgx files found in directory " + m_folderPath, MSG_ERROR);
+ 		else
+ 		{
+ 			m_projectName = fileInfo.name; // has the ".mgx"
+ 			_findclose( searchHandle );
+ 
+ 			m_projectFileName = m_folderPath;
+ 			m_projectFileName += "\\";
+ 			m_projectFileName += m_projectName;
+ 
+ 			m_projectName = m_projectName.erase( m_projectName.length() - 4); // cut the ".mgx"
+ 		}
+ 		return;
+ 	}
+ 
  	m_parentFolderPath = drive;
  	m_parentFolderPath += dir;
***************
*** 2149,2158 ****
  	m_cacheFileName = m_folderPath;
  	m_cacheFileName += "\\";
! 	m_cacheFileName += fname;
  	m_cacheFileName += ".bin";
  
  	m_projectFileName = m_folderPath;
  	m_projectFileName += "\\";
! 	m_projectFileName += fname;
  	m_projectFileName += ".mgx";
  
--- 2182,2191 ----
  	m_cacheFileName = m_folderPath;
  	m_cacheFileName += "\\";
! 	m_cacheFileName += m_projectName;
  	m_cacheFileName += ".bin";
  
  	m_projectFileName = m_folderPath;
  	m_projectFileName += "\\";
! 	m_projectFileName += m_projectName;
  	m_projectFileName += ".mgx";
  
***************
*** 3253,3257 ****
  	XERCES_CPP_NAMESPACE::DOMDocument * doc = parser->parseURI( m_projectFileName.c_str() );
  	if( doc == NULL )
! 		HR_THROW(E_FILEOPEN);
  	DOMElement * e = doc->getDocumentElement();
  
--- 3286,3298 ----
  	XERCES_CPP_NAMESPACE::DOMDocument * doc = parser->parseURI( m_projectFileName.c_str() );
  	if( doc == NULL )
! 	{
! 		setFileNames( true); // reset the file names
! 		doc = parser->parseURI( m_projectFileName.c_str() );
! 		if( doc == NULL)
! 		{
! 			sendMsg( "Could not find or parse project file " + m_projectFileName, MSG_ERROR);
! 			HR_THROW(E_FILEOPEN);
! 		}
! 	}
  	DOMElement * e = doc->getDocumentElement();
  

Index: CoreXmlFile.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/XmlBackEnd/CoreXmlFile.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** CoreXmlFile.h	19 Feb 2008 19:20:54 -0000	1.13
--- CoreXmlFile.h	19 Feb 2008 23:39:09 -0000	1.14
***************
*** 538,542 ****
  	void         svnOptions             ();
  
! 	void         setFileNames           ();
  
  	void         getContainerFileName   (XmlObject * obj, std::string& str, bool fullpath=true);
--- 538,542 ----
  	void         svnOptions             ();
  
! 	void         setFileNames           ( bool reset = false);
  
  	void         getContainerFileName   (XmlObject * obj, std::string& str, bool fullpath=true);



More information about the GME-commit mailing list