MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / NewWritableFile

Method NewWritableFile

tensorflow/core/platform/windows/windows_file_system.cc:273–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271}
272
273Status 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
293Status WindowsFileSystem::NewAppendableFile(
294 const string& fname, std::unique_ptr<WritableFile>* result) {

Callers

nothing calls this directly

Calls 4

Utf8ToWideCharFunction · 0.85
IOErrorFromWindowsErrorFunction · 0.85
c_strMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected