MCPcopy Create free account
hub / github.com/catboost/catboost / CopyTo

Method CopyTo

util/folder/path.cpp:470–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468}
469
470void TFsPath::CopyTo(const TString& newPath, bool force) const {
471 if (IsDirectory()) {
472 if (force) {
473 TFsPath(newPath).MkDirs();
474 } else if (!TFsPath(newPath).IsDirectory()) {
475 ythrow TIoException() << "Target path is not a directory " << newPath;
476 }
477 TVector<TFsPath> children;
478 List(children);
479 for (auto&& i : children) {
480 i.CopyTo(newPath + "/" + i.GetName(), force);
481 }
482 } else {
483 if (force) {
484 TFsPath(newPath).Parent().MkDirs();
485 } else {
486 if (!TFsPath(newPath).Parent().IsDirectory()) {
487 ythrow TIoException() << "Parent (" << TFsPath(newPath).Parent() << ") of a target path is not a directory " << newPath;
488 }
489 if (TFsPath(newPath).Exists()) {
490 ythrow TIoException() << "Path already exists " << newPath;
491 }
492 }
493 NFs::Copy(Path_, newPath);
494 }
495}
496
497void TFsPath::ForceRenameTo(const TString& newPath) const {
498 try {

Callers

nothing calls this directly

Calls 9

MkDirsMethod · 0.80
ParentMethod · 0.80
TFsPathClass · 0.70
IsDirectoryFunction · 0.50
ListClass · 0.50
CopyFunction · 0.50
IsDirectoryMethod · 0.45
GetNameMethod · 0.45
ExistsMethod · 0.45

Tested by

no test coverage detected