| 271 | } |
| 272 | |
| 273 | Status WindowsFileSystem::NewWritableFile( |
| 274 | const string& fname, std::unique_ptr<WritableFile>* result) { |
| 275 | string translated_fname = TranslateName(fname); |
| 276 | std::wstring ws_translated_fname = Utf8ToWideChar(translated_fname); |
| 277 | result->reset(); |
| 278 | |
| 279 | DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; |
| 280 | HANDLE hfile = |
| 281 | ::CreateFileW(ws_translated_fname.c_str(), GENERIC_WRITE, share_mode, |
| 282 | NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); |
| 283 | |
| 284 | if (INVALID_HANDLE_VALUE == hfile) { |
| 285 | string context = "Failed to create a NewWriteableFile: " + fname; |
| 286 | return IOErrorFromWindowsError(context, ::GetLastError()); |
| 287 | } |
| 288 | |
| 289 | result->reset(new WindowsWritableFile(translated_fname, hfile)); |
| 290 | return Status::OK(); |
| 291 | } |
| 292 | |
| 293 | Status WindowsFileSystem::NewAppendableFile( |
| 294 | const string& fname, std::unique_ptr<WritableFile>* result) { |
nothing calls this directly
no test coverage detected