MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / update

Method update

ui-linux/src/deployer.cpp:300–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300bool Deployer::update()
301{
302 if (m_soSourcePath.isEmpty()) {
303 m_statusMessage = "No bundled .so found to update from.";
304 emit statusMessageChanged();
305 return false;
306 }
307
308 if (!isElf32Bit(m_soSourcePath)) {
309 m_statusMessage = "Cannot update: cloud_redirect.so is not 32-bit, your compile is bad.";
310 emit statusMessageChanged();
311 return false;
312 }
313
314 QString crDir = crDataDir();
315 QDir().mkpath(crDir);
316
317 if (QFile::exists(m_soDeployPath)) {
318 if (!QFile::remove(m_soDeployPath)) {
319 m_statusMessage = "Cannot update: existing cloud_redirect.so is in use. Close Steam first.";
320 emit statusMessageChanged();
321 return false;
322 }
323 }
324
325 if (!QFile::copy(m_soSourcePath, m_soDeployPath)) {
326 m_statusMessage = "Failed to update cloud_redirect.so";
327 emit statusMessageChanged();
328 return false;
329 }
330 QFile::setPermissions(m_soDeployPath,
331 QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ExeOwner |
332 QFileDevice::ReadGroup | QFileDevice::ExeGroup |
333 QFileDevice::ReadOther | QFileDevice::ExeOther);
334
335 if (!m_cliSourcePath.isEmpty()) {
336 if (QFile::exists(m_cliDeployPath))
337 QFile::remove(m_cliDeployPath);
338 if (QFile::copy(m_cliSourcePath, m_cliDeployPath)) {
339 QFile::setPermissions(m_cliDeployPath,
340 QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ExeOwner |
341 QFileDevice::ReadGroup | QFileDevice::ExeGroup |
342 QFileDevice::ReadOther | QFileDevice::ExeOther);
343 }
344 }
345
346 m_updateAvailable = false;
347 m_statusMessage = "Updated successfully. Restart Steam to use the new version.";
348 emit statusMessageChanged();
349 emit checkCompleted();
350 return true;
351}
352
353bool Deployer::undeploy()
354{

Callers

nothing calls this directly

Calls 2

isElf32BitFunction · 0.85
crDataDirFunction · 0.85

Tested by

no test coverage detected