MCPcopy Create free account
hub / github.com/HO-COOH/FastCopy / copyFolderAddSuffixImpl

Function copyFolderAddSuffixImpl

FastCopy/Fallback.cpp:7–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5namespace Fallback
6{
7 static bool copyFolderAddSuffixImpl(std::filesystem::path const& source, std::filesystem::path const& destination)
8 {
9 auto const folderName = source.filename().wstring();
10 std::error_code ec;
11 for (int suffix = 1;; ++suffix)
12 {
13 auto const fullPath = std::format(LR"({}\{}({}))", destination.wstring(), folderName, suffix);
14 if (!std::filesystem::exists(fullPath))
15 {
16
17 std::filesystem::copy(source, fullPath, std::filesystem::copy_options::recursive
18 |std::filesystem::copy_options::update_existing, ec);
19 return bool{ ec };
20 }
21 }
22 }
23
24 static bool copyFileAddSuffixImpl(std::filesystem::path const& source, std::filesystem::path const& destination)
25 {

Callers 1

CopyAddSuffixFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected