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

Method NewAppendableFile

src/leveldb/util/env_windows.cc:469–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 3

WindowsErrorFunction · 0.85
OKFunction · 0.85
is_validMethod · 0.45

Tested by

no test coverage detected