MCPcopy Create free account
hub / github.com/ElementsProject/elements / NewWritableFile

Method NewWritableFile

src/leveldb/util/env_windows.cc:451–467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 3

WindowsErrorFunction · 0.85
OKFunction · 0.85
is_validMethod · 0.45

Tested by

no test coverage detected