From: Christian S. <blu...@us...> - 2004-07-29 15:22:01
|
Update of /cvsroot/planeshift/planeshift/src/updater In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26329/src/updater Modified Files: fileutil.cpp psupdaterengine.cpp updater.cpp Log Message: - Some DLLs/EXEs in use fixes and selfupdating updated Index: fileutil.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/updater/fileutil.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** fileutil.cpp 4 Jul 2004 05:02:44 -0000 1.3 --- fileutil.cpp 29 Jul 2004 15:21:52 -0000 1.4 *************** *** 121,125 **** if (rc < 0) ! CRTError2("Couldn't create directory '%s'.", directory); } #endif --- 121,125 ---- if (rc < 0) ! printf("Couldn't create directory '%s'.", directory); } #endif Index: psupdaterengine.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/updater/psupdaterengine.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** psupdaterengine.cpp 28 Jul 2004 09:23:52 -0000 1.9 --- psupdaterengine.cpp 29 Jul 2004 15:21:52 -0000 1.10 *************** *** 448,452 **** { bool silent = false; - bool update = false; bool compare = false; --- 448,451 ---- *************** *** 460,464 **** silent = cmdParser->GetBoolOption("silent"); create = cmdParser->GetOption("create"); - update = cmdParser->GetBoolOption("update"); compare = cmdParser->GetBoolOption("compare"); updaterep= cmdParser->GetOption("updaterep"); --- 459,462 ---- *************** *** 479,483 **** silent = true; ! if (update || compare) silent = true; --- 477,481 ---- silent = true; ! if (compare) silent = true; *************** *** 514,522 **** psupdaterengine->QuitClient(); } - else if (update) - { - psupdaterengine->GetUpdater()->UpdateUpdater(); - psupdaterengine->QuitClient(); - } else if (updaterep.Length() > 0) { --- 512,515 ---- Index: updater.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/updater/updater.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** updater.cpp 28 Jul 2004 09:23:52 -0000 1.11 --- updater.cpp 29 Jul 2004 15:21:52 -0000 1.12 *************** *** 218,222 **** if (newregistry && registrycache) { ! for (int i=0;i<modulechoice.Length();i++) { const char* module = modulechoice[i]; --- 218,222 ---- if (newregistry && registrycache) { ! for (size_t i=0;i<modulechoice.Length();i++) { const char* module = modulechoice[i]; *************** *** 290,294 **** // Part2: Check for updated files ! for (int m=0;m<modulechoice.Length();m++) { const char* module = modulechoice[m]; --- 290,294 ---- // Part2: Check for updated files ! for (size_t m=0;m<modulechoice.Length();m++) { const char* module = modulechoice[m]; *************** *** 400,404 **** bool Updater::PerformUpdates (ChangeList& changelist) { ! pawsUpdaterWindow* updWnd; --- 400,404 ---- bool Updater::PerformUpdates (ChangeList& changelist) { ! pawsUpdaterWindow* updWnd = NULL; *************** *** 413,417 **** psupdaterengine->OutToScreen("==== Update started ===="); ! for (int i=0;i<changelist.Length();i++) { csString base = config->GetCurrentFilesDirectory(); --- 413,417 ---- psupdaterengine->OutToScreen("==== Update started ===="); ! for (size_t i=0;i<changelist.Length();i++) { csString base = config->GetCurrentFilesDirectory(); *************** *** 492,495 **** --- 492,496 ---- case Change::CREATEFILE: { + // Create the URL serverpath = base; serverpath.Append ("/"); *************** *** 523,526 **** --- 524,528 ---- output.Format("%s (%0.2f %s)",(const char*) changelist[i].file->file, fsize,unit.GetData()); + // Notify the user if (!psupdaterengine->IsSilent()) { *************** *** 533,536 **** --- 535,539 ---- + // Now do the download if (!downloader->DownloadFile (config->GetTempFile().GetData(), serverpath, *************** *** 563,570 **** } ! CopyFile( "/this/" + config->GetTempFile() ,"/zip/" + changelist[i].file->zipFile, ! true); if (!vfs->Sync()) --- 566,577 ---- } ! if(CopyFile( "/this/" + config->GetTempFile() ,"/zip/" + changelist[i].file->zipFile, ! true)) ! { ! failed.Push(changelist[i].file->file); ! continue; ! } if (!vfs->Sync()) *************** *** 587,591 **** //Copy temp file to real location ! CopyFile(config->GetTempFile(),changelist[i].file->file); csString doneStr("Updated "); --- 594,623 ---- //Copy temp file to real location ! if(!CopyFile(config->GetTempFile(),changelist[i].file->file)) ! { ! #ifdef OS_WIN32 ! ! printf("Doing DLL check on %s\n",changelist[i].file->file.GetData()); ! ! // If we failed to copy file, it might be a DLL in use, check it ! csString file = changelist[i].file->file; ! csString ext = file.Slice(file.FindLast('.') +1,file.Length()); ! ext.Downcase(); ! ! if(ext == "dll") ! { ! if(!psupdaterengine->GetVFS()->Exists("/this/updatertemp")) ! MakeDirectory("updatertemp"); ! ! system("move " + file + " updatertemp"); ! if(!CopyFile(config->GetTempFile(),changelist[i].file->file)) ! psupdaterengine->OutToScreen("DLL fallback failed for file" + file); ! else ! continue; ! } ! #endif ! failed.Push(changelist[i].file->file); ! continue; ! } csString doneStr("Updated "); *************** *** 691,695 **** psupdaterengine->OutToScreen(output.GetData()); ! for (int i = 0; i < failed.Length(); i++) { output = failed.Get(i); --- 723,727 ---- psupdaterengine->OutToScreen(output.GetData()); ! for (size_t i = 0; i < failed.Length(); i++) { output = failed.Get(i); *************** *** 839,945 **** // Prepare to enter selfupdating mode #ifdef OS_WIN32 ! // Copy the updater ! TEMPCOPYFILE("updater.exe"); ! ! ! // Copy other CS files we need ! /* NOTE: ! * This seems not to be nessesary because ! * we will be running the app in the root dir. ! * If you need to copy the CS files, just ! * uncomment this code below and it should ! * work. ! * //blueCommand ! */ ! ! /* ! csString crystalPath = getenv("CRYSTAL"); ! if (crystalPath.GetAt(crystalPath.Length()-1) != '\\') ! { ! crystalPath += "\\"; ! } ! ! csRef<iDataBuffer> fileBuff = psupdaterengine->GetVFS()->GetRealPath(crystalPath); ! csString vfsPath; ! ! if (!fileBuff) ! vfsPath = crystalPath; ! else ! vfsPath = fileBuff->GetData(); ! ! if (!psupdaterengine->GetVFS()->Mount("/crystal",vfsPath)) ! { ! CRTError("Couldn't mount temporary copy path!\n"); ! return false; ! } ! ! TEMPCOPYCSFILE("vfs.dll"); ! TEMPCOPYCSFILE("libz.dll"); ! TEMPCOPYCSFILE("sndsoft.dll"); ! TEMPCOPYCSFILE("xmlread.dll"); ! TEMPCOPYCSFILE("imgplex.dll"); ! TEMPCOPYCSFILE("sndwav.dll"); ! TEMPCOPYCSFILE("sndogg.dll"); ! TEMPCOPYCSFILE("vorbisfile.dll"); ! TEMPCOPYCSFILE("ogg.dll"); ! TEMPCOPYCSFILE("vorbis.dll"); ! TEMPCOPYCSFILE("sndplex.dll"); ! TEMPCOPYCSFILE("freefnt2.dll"); ! TEMPCOPYCSFILE("libfreetype2.dll"); ! TEMPCOPYCSFILE("csfont.dll"); ! TEMPCOPYCSFILE("fontplex.dll"); ! TEMPCOPYCSFILE("glrender3d.dll"); ! TEMPCOPYCSFILE("engine.dll"); ! TEMPCOPYCSFILE("cssynldr.dll"); ! TEMPCOPYCSFILE("reporter.dll"); ! TEMPCOPYCSFILE("stdrep.dll"); ! TEMPCOPYCSFILE("sndwaveout.dll"); ! TEMPCOPYCSFILE("csbmpimg.dll"); ! TEMPCOPYCSFILE("csddsimg.dll"); ! TEMPCOPYCSFILE("csgifimg.dll"); ! TEMPCOPYCSFILE("csjngimg.dll"); ! TEMPCOPYCSFILE("libmng.dll"); ! TEMPCOPYCSFILE("libjpeg.dll"); ! TEMPCOPYCSFILE("csjpgimg.dll"); ! TEMPCOPYCSFILE("cspngimg.dll"); ! TEMPCOPYCSFILE("libpng.dll"); ! TEMPCOPYCSFILE("cssgiimg.dll"); ! TEMPCOPYCSFILE("cstgaimg.dll"); ! TEMPCOPYCSFILE("cswalimg.dll"); ! TEMPCOPYCSFILE("glwin32.dll"); ! TEMPCOPYCSFILE("rendstep_std.dll"); ! TEMPCOPYCSFILE("shadermgr.dll"); ! TEMPCOPYCSFILE("xmlshader.dll"); ! TEMPCOPYCSFILE("glshader_fixed.dll"); ! ! ! if (!psupdaterengine->GetVFS()->Mount("/crystal",vfsPath)) ! { ! CRTError("Couldn't unmount temporary copy path!"); ! return false; ! }*/ ! ! // Lanuch the new updater ! STARTUPINFO si; ! PROCESS_INFORMATION pi; ! ! ZeroMemory( &si, sizeof(si) ); ! si.cb = sizeof(si); ! ZeroMemory( &pi, sizeof(pi) ); ! ! // Start the second updater process. ! CreateProcess( NULL, // No module name (use command line). ! "updatertemp/updater.exe --update", // Command line. ! // Note: ^^^^^ will start the updater.exe, but working dir will be the root dir ! NULL, // Process handle not inheritable. ! NULL, // Thread handle not inheritable. ! FALSE, // Set handle inheritance to FALSE. ! 0, // No creation flags. ! NULL, // Use parent's environment block. ! NULL, // Use parent's starting directory. ! &si, // Pointer to STARTUPINFO structure. ! &pi ) // Pointer to PROCESS_INFORMATION structure. ! ; ! #else // ToDo: Add *NIX here --- 871,875 ---- // Prepare to enter selfupdating mode #ifdef OS_WIN32 ! UpdateUpdater(); #else // ToDo: Add *NIX here *************** *** 969,973 **** fileName +=".exe"; ! printf("Updating updater..\t"); if (downloader->DownloadFile("updater.tmp",config->GetCurrentFilesDirectory() + csString("/") + fileName,true)) { --- 899,915 ---- fileName +=".exe"; ! csString ver; ! ver = version; ! for(int i = 1;i < ver.Length();i++) ! { ! ver.Insert(i,'.'); ! i++; // Jump twice ! } ! ! psupdaterengine->OutToScreen( "Updating updater to version " + ver ); ! ! MakeDirectory("updatertemp"); ! system("move updater.exe updatertemp"); ! if (downloader->DownloadFile("updater.tmp",config->GetCurrentFilesDirectory() + csString("/") + fileName,true)) { *************** *** 1024,1028 **** if (list.Length()) { ! for (int i=0; i<list.Length(); i++) { csString entry; --- 966,970 ---- if (list.Length()) { ! for (size_t i=0; i<list.Length(); i++) { csString entry; |