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

Method MoveFile

src/engine/client/updater.cpp:172–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172bool CUpdater::MoveFile(const char *pFile)
173{
174 char aBuf[256];
175 const size_t Length = str_length(pFile);
176 bool Success = true;
177
178#if !defined(CONF_FAMILY_WINDOWS)
179 if(!str_comp_nocase(pFile + Length - 4, ".dll"))
180 return Success;
181#endif
182
183#if !defined(CONF_PLATFORM_LINUX)
184 if(!str_comp_nocase(pFile + Length - 3, ".so"))
185 return Success;
186#endif
187
188 if(!str_comp_nocase(pFile + Length - 4, ".dll") || !str_comp_nocase(pFile + Length - 4, ".ttf") || !str_comp_nocase(pFile + Length - 3, ".so"))
189 {
190 str_format(aBuf, sizeof(aBuf), "%s.old", pFile);
191 m_pStorage->RenameBinaryFile(pFile, aBuf);
192 str_format(aBuf, sizeof(aBuf), "update/%s", pFile);
193 Success &= m_pStorage->RenameBinaryFile(aBuf, pFile);
194 }
195 else
196 {
197 str_format(aBuf, sizeof(aBuf), "update/%s", pFile);
198 Success &= m_pStorage->RenameBinaryFile(aBuf, pFile);
199 }
200
201 return Success;
202}
203
204void CUpdater::Update()
205{

Callers

nothing calls this directly

Calls 4

str_lengthFunction · 0.85
str_comp_nocaseFunction · 0.85
str_formatFunction · 0.85
RenameBinaryFileMethod · 0.80

Tested by

no test coverage detected