MCPcopy Create free account
hub / github.com/apache/arrow / Move

Method Move

cpp/src/arrow/filesystem/localfs.cc:613–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

611}
612
613Status LocalFileSystem::Move(const std::string& src, const std::string& dest) {
614 RETURN_NOT_OK(ValidatePath(src));
615 RETURN_NOT_OK(ValidatePath(dest));
616 ARROW_ASSIGN_OR_RAISE(auto sfn, PlatformFilename::FromString(src));
617 ARROW_ASSIGN_OR_RAISE(auto dfn, PlatformFilename::FromString(dest));
618
619#ifdef _WIN32
620 if (!MoveFileExW(sfn.ToNative().c_str(), dfn.ToNative().c_str(),
621 MOVEFILE_REPLACE_EXISTING)) {
622 return IOErrorFromWinError(GetLastError(), "Failed renaming '", sfn.ToString(),
623 "' to '", dfn.ToString(), "'");
624 }
625#else
626 if (rename(sfn.ToNative().c_str(), dfn.ToNative().c_str()) != 0) {
627 return IOErrorFromErrno(errno, "Failed renaming '", sfn.ToString(), "' to '",
628 dfn.ToString(), "'");
629 }
630#endif
631 return Status::OK();
632}
633
634Status LocalFileSystem::CopyFile(const std::string& src, const std::string& dest) {
635 RETURN_NOT_OK(ValidatePath(src));

Callers

nothing calls this directly

Calls 5

IOErrorFromWinErrorFunction · 0.85
IOErrorFromErrnoFunction · 0.85
ValidatePathFunction · 0.70
OKFunction · 0.50
ToStringMethod · 0.45

Tested by

no test coverage detected