MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / sweepTempFiles

Method sweepTempFiles

switch/source/transfer.cpp:528–551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526}
527
528void Transfer::sweepTempFiles(void)
529{
530 if (io::fileExists(TEMP_UPLOAD)) {
531 std::remove(TEMP_UPLOAD);
532 Logging::info("Removed leftover {} from a previous run.", TEMP_UPLOAD);
533 }
534
535 Directory dir(CHECKPOINT_ROOT);
536 if (!dir.good()) {
537 return;
538 }
539 for (size_t i = 0, sz = dir.size(); i < sz; i++) {
540 if (dir.folder(i)) {
541 continue;
542 }
543 std::string name = dir.entry(i);
544 if (name.size() > TEMP_SEND_PREFIX.size() + TEMP_SEND_SUFFIX.size() && name.compare(0, TEMP_SEND_PREFIX.size(), TEMP_SEND_PREFIX) == 0 &&
545 name.compare(name.size() - TEMP_SEND_SUFFIX.size(), TEMP_SEND_SUFFIX.size(), TEMP_SEND_SUFFIX) == 0) {
546 std::string path = std::string(CHECKPOINT_ROOT) + name;
547 std::remove(path.c_str());
548 Logging::info("Removed leftover {} from a previous run.", name);
549 }
550 }
551}
552
553bool Transfer::startReceiver(std::string& outError)
554{

Callers

nothing calls this directly

Calls 7

infoFunction · 0.85
stringFunction · 0.85
compareMethod · 0.80
goodMethod · 0.45
sizeMethod · 0.45
folderMethod · 0.45
entryMethod · 0.45

Tested by

no test coverage detected