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

Method copyDirectory

switch/source/io.cpp:343–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341}
342
343Result io::copyDirectory(const std::string& srcPath, const std::string& dstPath, ProgressSink& sink, u64 commitWriteLimit)
344{
345 Result res = 0;
346 Directory items(srcPath);
347
348 if (!items.good()) {
349 return items.error();
350 }
351
352 for (size_t i = 0, sz = items.size(); i < sz && R_SUCCEEDED(res); i++) {
353 if (sink.cancelled()) {
354 break;
355 }
356
357 std::string newsrc = srcPath + items.entry(i);
358 std::string newdst = dstPath + items.entry(i);
359
360 if (items.folder(i)) {
361 res = io::createDirectory(newdst);
362 if (R_SUCCEEDED(res)) {
363 newsrc += "/";
364 newdst += "/";
365 res = io::copyDirectory(newsrc, newdst, sink, commitWriteLimit);
366 }
367 }
368 else {
369 res = io::copyFile(newsrc, newdst, sink, commitWriteLimit);
370 }
371 }
372
373 return res;
374}
375
376Result io::createDirectory(const std::string& path)
377{

Callers

nothing calls this directly

Calls 6

goodMethod · 0.45
errorMethod · 0.45
sizeMethod · 0.45
cancelledMethod · 0.45
entryMethod · 0.45
folderMethod · 0.45

Tested by

no test coverage detected