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

Method GetChildren

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

Source from the content-addressed store, hash-verified

408}
409
410Status WindowsFileSystem::GetChildren(const string& dir,
411 std::vector<string>* result) {
412 string translated_dir = TranslateName(dir);
413 std::wstring ws_translated_dir = Utf8ToWideChar(translated_dir);
414 result->clear();
415
416 std::wstring pattern = ws_translated_dir;
417 if (!pattern.empty() && pattern.back() != '\\' && pattern.back() != '/') {
418 pattern += L"\\*";
419 } else {
420 pattern += L'*';
421 }
422
423 WIN32_FIND_DATAW find_data;
424 HANDLE find_handle = ::FindFirstFileW(pattern.c_str(), &find_data);
425 if (find_handle == INVALID_HANDLE_VALUE) {
426 string context = "FindFirstFile failed for: " + translated_dir;
427 return IOErrorFromWindowsError(context, ::GetLastError());
428 }
429
430 do {
431 string file_name = WideCharToUtf8(find_data.cFileName);
432 const StringPiece basename = file_name;
433 if (basename != "." && basename != "..") {
434 result->push_back(file_name);
435 }
436 } while (::FindNextFileW(find_handle, &find_data));
437
438 if (!::FindClose(find_handle)) {
439 string context = "FindClose failed for: " + translated_dir;
440 return IOErrorFromWindowsError(context, ::GetLastError());
441 }
442
443 return Status::OK();
444}
445
446Status WindowsFileSystem::DeleteFile(const string& fname) {
447 Status result;

Callers

nothing calls this directly

Calls 8

Utf8ToWideCharFunction · 0.85
IOErrorFromWindowsErrorFunction · 0.85
WideCharToUtf8Function · 0.85
c_strMethod · 0.80
clearMethod · 0.45
emptyMethod · 0.45
backMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected