| 91 | } |
| 92 | |
| 93 | void Explorer::CopyFile(const std::string &path, const std::string &new_path) { |
| 94 | const auto full_path = this->MakeFull(path); |
| 95 | auto exp = GetExplorerForPath(new_path); |
| 96 | const auto full_new_path = exp->MakeFull(new_path); |
| 97 | auto work_buf = AllocateWorkBuffer(); |
| 98 | auto rem_size = this->GetFileSize(full_path); |
| 99 | u64 offset = 0; |
| 100 | this->StartFile(full_path, fs::FileMode::Read); |
| 101 | exp->StartFile(full_new_path, fs::FileMode::Write); |
| 102 | while(rem_size) { |
| 103 | const auto read_size = this->ReadFile(full_path, offset, std::min(rem_size, DefaultWorkBufferSize), work_buf); |
| 104 | rem_size -= read_size; |
| 105 | offset += read_size; |
| 106 | exp->WriteFile(new_path, work_buf, read_size); |
| 107 | } |
| 108 | DeleteWorkBuffer(work_buf); |
| 109 | this->EndFile(); |
| 110 | exp->EndFile(); |
| 111 | } |
| 112 | |
| 113 | void Explorer::CopyDirectory(const std::string &dir, const std::string &new_dir) { |
| 114 | const auto full_dir = this->MakeFull(dir); |
no test coverage detected