| 611 | } |
| 612 | |
| 613 | Status 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 | |
| 634 | Status LocalFileSystem::CopyFile(const std::string& src, const std::string& dest) { |
| 635 | RETURN_NOT_OK(ValidatePath(src)); |
nothing calls this directly
no test coverage detected