@@ -382,21 +382,31 @@ class DiskPlotter {
382
382
}
383
383
} else {
384
384
if (!bCopied) {
385
- fs::copy (
386
- tmp_2_filename, final_2_filename, fs::copy_options::overwrite_existing, ec);
385
+ fs::rename (tmp_2_filename, final_filename, ec);
387
386
if (ec.value () != 0 ) {
388
- std::cout << " Could not copy " << tmp_2_filename << " to "
389
- << final_2_filename << " . Error " << ec.message ()
390
- << " . Retrying in five minutes." << std::endl;
387
+ fs::copy (
388
+ tmp_2_filename,
389
+ final_2_filename,
390
+ fs::copy_options::overwrite_existing,
391
+ ec);
392
+ if (ec.value () != 0 ) {
393
+ std::cout << " Could not copy " << tmp_2_filename << " to "
394
+ << final_2_filename << " . Error " << ec.message ()
395
+ << " . Retrying in five minutes." << std::endl;
396
+ } else {
397
+ std::cout << " Copied final file from " << tmp_2_filename << " to "
398
+ << final_2_filename << std::endl;
399
+ copy.PrintElapsed (" Copy time =" );
400
+ bCopied = true ;
401
+
402
+ bool removed_2 = fs::remove (tmp_2_filename);
403
+ std::cout << " Removed temp2 file " << tmp_2_filename << " ? "
404
+ << removed_2 << std::endl;
405
+ }
391
406
} else {
392
- std::cout << " Copied final file from " << tmp_2_filename << " to "
393
- << final_2_filename << std::endl;
394
- copy.PrintElapsed (" Copy time =" );
395
- bCopied = true ;
396
-
397
- bool removed_2 = fs::remove (tmp_2_filename);
398
- std::cout << " Removed temp2 file " << tmp_2_filename << " ? " << removed_2
399
- << std::endl;
407
+ bRenamed = true ;
408
+ std::cout << " Renamed final file from " << tmp_2_filename << " to "
409
+ << final_filename << std::endl;
400
410
}
401
411
}
402
412
if (bCopied && (!bRenamed)) {
0 commit comments