MCPcopy Create free account
hub / github.com/ElectroZybr/LatticeLab / makeDatedCaptureOutputPath

Method makeDatedCaptureOutputPath

App/capture/CaptureOutputPath.cpp:39–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39std::filesystem::path capture_utils::makeDatedCaptureOutputPath(const std::filesystem::path& outputDirectory,
40 std::string_view extension) {
41 const auto now = std::chrono::system_clock::now();
42 const std::string datePrefix = std::format("{:%Y-%m-%d}", std::chrono::floor<std::chrono::days>(now));
43
44 uint32_t nextIndex = 1;
45 std::error_code fsError;
46 for (std::filesystem::directory_iterator it(outputDirectory, fsError), end; !fsError && it != end; it.increment(fsError)) {
47 if (fsError || !it->is_regular_file(fsError)) {
48 continue;
49 }
50 if (const std::optional<uint32_t> index = parseDailyCaptureIndex(it->path(), datePrefix, extension)) {
51 nextIndex = std::max(nextIndex, *index + 1);
52 }
53 }
54
55 return outputDirectory / std::format("{}_{}{}", datePrefix, nextIndex, extension);
56}

Callers

nothing calls this directly

Calls 1

parseDailyCaptureIndexFunction · 0.85

Tested by

no test coverage detected