| 449 | } |
| 450 | |
| 451 | Status NewWritableFile(const std::string& filename, |
| 452 | WritableFile** result) override { |
| 453 | DWORD desired_access = GENERIC_WRITE; |
| 454 | DWORD share_mode = 0; // Exclusive access. |
| 455 | auto wFilename = toUtf16(filename); |
| 456 | ScopedHandle handle = ::CreateFileW( |
| 457 | wFilename.c_str(), desired_access, share_mode, |
| 458 | /*lpSecurityAttributes=*/nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, |
| 459 | /*hTemplateFile=*/nullptr); |
| 460 | if (!handle.is_valid()) { |
| 461 | *result = nullptr; |
| 462 | return WindowsError(filename, ::GetLastError()); |
| 463 | } |
| 464 | |
| 465 | *result = new WindowsWritableFile(filename, std::move(handle)); |
| 466 | return Status::OK(); |
| 467 | } |
| 468 | |
| 469 | Status NewAppendableFile(const std::string& filename, |
| 470 | WritableFile** result) override { |
nothing calls this directly
no test coverage detected