| 686 | namespace { |
| 687 | |
| 688 | Result<std::shared_ptr<io::OutputStream>> OpenOutputStreamGeneric(const std::string& path, |
| 689 | bool truncate, |
| 690 | bool append) { |
| 691 | RETURN_NOT_OK(ValidatePath(path)); |
| 692 | ARROW_ASSIGN_OR_RAISE(auto fn, PlatformFilename::FromString(path)); |
| 693 | const bool write_only = true; |
| 694 | ARROW_ASSIGN_OR_RAISE( |
| 695 | auto fd, ::arrow::internal::FileOpenWritable(fn, write_only, truncate, append)); |
| 696 | int raw_fd = fd.Detach(); |
| 697 | auto maybe_stream = io::FileOutputStream::Open(raw_fd); |
| 698 | if (!maybe_stream.ok()) { |
| 699 | ARROW_UNUSED(::arrow::internal::FileClose(raw_fd)); |
| 700 | } |
| 701 | return maybe_stream; |
| 702 | } |
| 703 | |
| 704 | } // namespace |
| 705 |
no test coverage detected