| 467 | } |
| 468 | |
| 469 | Status NewAppendableFile(const std::string& filename, |
| 470 | WritableFile** result) override { |
| 471 | DWORD desired_access = FILE_APPEND_DATA; |
| 472 | DWORD share_mode = 0; // Exclusive access. |
| 473 | auto wFilename = toUtf16(filename); |
| 474 | ScopedHandle handle = ::CreateFileW( |
| 475 | wFilename.c_str(), desired_access, share_mode, |
| 476 | /*lpSecurityAttributes=*/nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, |
| 477 | /*hTemplateFile=*/nullptr); |
| 478 | if (!handle.is_valid()) { |
| 479 | *result = nullptr; |
| 480 | return WindowsError(filename, ::GetLastError()); |
| 481 | } |
| 482 | |
| 483 | *result = new WindowsWritableFile(filename, std::move(handle)); |
| 484 | return Status::OK(); |
| 485 | } |
| 486 | |
| 487 | bool FileExists(const std::string& filename) override { |
| 488 | auto wFilename = toUtf16(filename); |
nothing calls this directly
no test coverage detected