MCPcopy Create free account
hub / github.com/ddnet/ddnet / CommitUpdate

Method CommitUpdate

src/engine/client/updater.cpp:434–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434void CUpdater::CommitUpdate()
435{
436 bool Success = true;
437
438 for(auto &FileJob : m_FileJobs)
439 if(FileJob.second)
440 Success &= MoveFile(FileJob.first.c_str());
441
442 if(m_ClientUpdate)
443 Success &= ReplaceClient();
444 if(m_ServerUpdate)
445 Success &= ReplaceServer();
446
447 if(Success)
448 {
449 for(const auto &[Filename, JobSuccess] : m_FileJobs)
450 if(!JobSuccess)
451 m_pStorage->RemoveBinaryFile(Filename.c_str());
452 }
453
454 if(!Success)
455 SetCurrentState(IUpdater::FAIL);
456 else if(m_pClient->State() == IClient::STATE_ONLINE || m_pClient->EditorHasUnsavedData())
457 SetCurrentState(IUpdater::NEED_RESTART);
458 else
459 {
460 m_pClient->Restart();
461 }
462}

Callers

nothing calls this directly

Calls 4

RemoveBinaryFileMethod · 0.80
EditorHasUnsavedDataMethod · 0.80
RestartMethod · 0.80
StateMethod · 0.45

Tested by

no test coverage detected