14 source,
"stat",
"not found");
18 throw std::runtime_error(
"can't stat " + source);
20 if (sourceStat->isDir()) {
23 auto mapEntry =
getDstPath(source, dstPath,
true);
26 throw std::runtime_error(source +
" is a directory");
32 source, source, mapEntry,
33 copyRequest::clock_type::now()));
39 for (
auto& source : sources) {
43 escaper->deEscape(source, srcbuf);
50 std::unique_ptr<copyRequest::base> item(request);
57 const std::string& dstpath,
65 std::unique_ptr<const genericStat> dirStat;
66 subdirType(
const std::string& aSrcPath,
67 const std::string& aDstPath,
68 std::unique_ptr<const genericStat>& aDirStat) :
71 dirStat(std::move(aDirStat)) {};
73 std::list<subdirType> subdirs;
77 std::string subpath(srcpath);
79 subpath += entry->getName();
80 std::string destpath(dstpath);
82 destpath += entry->getName();
83 auto entryStat = entry->getStat();
85 if (entryStat->isDir() &&
86 entryStat->device == dirStat.
device) {
87 subdirs.emplace_back(subpath, destpath, entryStat);
88 }
else if (entryStat->isRegularFile() || entryStat->isLink()) {
90 subpath, subpath, mapEntry,
91 copyRequest::clock_type::now()));
96 for (
auto& subdir : subdirs) {
97 addDirContent(subdir.srcPath, subdir.dstPath, mapEntry, *(subdir.dirStat));