MCPcopy Create free account
hub / github.com/baldurk/renderdoc / SaveCaptureTo

Method SaveCaptureTo

qrenderdoc/Code/CaptureContext.cpp:1344–1417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1342}
1343
1344bool CaptureContext::SaveCaptureTo(const rdcstr &captureFile)
1345{
1346 bool success = false;
1347 QString error;
1348
1349 if(IsCaptureLocal())
1350 {
1351 if(QFileInfo(GetCaptureFilename()).exists())
1352 {
1353 if(GetCaptureFilename() == captureFile)
1354 {
1355 success = true;
1356 }
1357 else
1358 {
1359 ICaptureFile *capFile = m_Replay.GetCaptureFile();
1360
1361 if(capFile)
1362 {
1363 // this will overwrite
1364 ResultDetails result = capFile->CopyFileTo(captureFile);
1365 success = result.OK();
1366 error = result.Message();
1367 }
1368 else
1369 {
1370 // QFile::copy won't overwrite, so remove the destination first (the save dialog already
1371 // prompted for overwrite)
1372 QFile::remove(captureFile);
1373 success = QFile::copy(GetCaptureFilename(), captureFile);
1374 error = tr("File move failed");
1375 }
1376
1377 error = tr("Couldn't save to %1: %2").arg(captureFile).arg(error);
1378 }
1379 }
1380 else
1381 {
1382 error = tr("Capture '%1' couldn't be found on disk, cannot save.").arg(GetCaptureFilename());
1383 success = false;
1384 RDDialog::critical(NULL, tr("File not found"), error);
1385 }
1386 }
1387 else
1388 {
1389 Replay().CopyCaptureFromRemote(GetCaptureFilename(), captureFile, m_MainWindow);
1390 success = QFile::exists(captureFile);
1391
1392 error = tr("File couldn't be transferred from remote host");
1393 }
1394
1395 if(!success)
1396 {
1397 RDDialog::critical(NULL, tr("Error Saving"), error);
1398 return false;
1399 }
1400
1401 // if it was a temporary capture, remove the old instnace

Callers

nothing calls this directly

Calls 13

criticalFunction · 0.85
existsMethod · 0.80
GetCaptureFileMethod · 0.80
RemoveRecentCaptureMethod · 0.80
ReopenCaptureFileMethod · 0.80
trFunction · 0.70
QFileInfoClass · 0.50
removeFunction · 0.50
copyFunction · 0.50
existsFunction · 0.50
CopyFileToMethod · 0.45
argMethod · 0.45

Tested by

no test coverage detected