Update of /cvsroot/decaldev/source/DenAgent
In directory sc8-pr-cvs1:/tmp/cvs-serv31883
Modified Files:
AutoUpdate.cpp
Log Message:
fix for when DeleteFile doesn't work due to something locking it
Index: AutoUpdate.cpp
===================================================================
RCS file: /cvsroot/decaldev/source/DenAgent/AutoUpdate.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** AutoUpdate.cpp 20 Oct 2002 16:35:36 -0000 1.6
--- AutoUpdate.cpp 1 Apr 2003 23:49:04 -0000 1.7
***************
*** 406,429 ****
std::string tmpFile = (m_DecalDir + "\\" + aUSource.getDestination() + ".tmp");
! DeleteFile(newFile.c_str());
!
! MoveFile(tmpFile.c_str(), newFile.c_str());
! // We may have to register DLLs
! if (aUSource.getType() == AU_TYPE_DLL || aUSource.getType() == AU_TYPE_BETADLL ) {
! HINSTANCE hDLL = AfxLoadLibrary(newFile.c_str());
! if (hDLL) {
! typedef CRuntimeClass * (*DLLREG)();
! DLLREG DllReg = (DLLREG)GetProcAddress(hDLL, "DllRegisterServer");
!
! if (DllReg != NULL)
! DllReg();
! AfxFreeLibrary(hDLL);
}
}
}
--- 406,435 ----
std::string tmpFile = (m_DecalDir + "\\" + aUSource.getDestination() + ".tmp");
! if( DeleteFile( newFile.c_str() ) )
! {
! MoveFile(tmpFile.c_str(), newFile.c_str());
! // We may have to register DLLs
! if (aUSource.getType() == AU_TYPE_DLL || aUSource.getType() == AU_TYPE_BETADLL )
! {
! HINSTANCE hDLL = AfxLoadLibrary(newFile.c_str());
! if (hDLL) {
! typedef CRuntimeClass * (*DLLREG)();
! DLLREG DllReg = (DLLREG)GetProcAddress(hDLL, "DllRegisterServer");
!
! if (DllReg != NULL)
! DllReg();
! AfxFreeLibrary(hDLL);
! }
}
}
+
+ // Delete failed - file is in use
+ else
+ MessageBox(NULL, "A file being updated is in use - close programs and try again.", "Decal", MB_OK);
}
|