| 740 | } |
| 741 | |
| 742 | Status FindOneFile(const PlatformFilename& fn, WIN32_FIND_DATAW* find_data, |
| 743 | bool* exists = nullptr) { |
| 744 | HANDLE handle = FindFirstFileW(PathWithoutTrailingSlash(fn).c_str(), find_data); |
| 745 | if (handle == INVALID_HANDLE_VALUE) { |
| 746 | int errnum = GetLastError(); |
| 747 | if (exists == nullptr || |
| 748 | (errnum != ERROR_PATH_NOT_FOUND && errnum != ERROR_FILE_NOT_FOUND)) { |
| 749 | return IOErrorFromWinError(GetLastError(), "Cannot get information for path '", |
| 750 | fn.ToString(), "'"); |
| 751 | } |
| 752 | *exists = false; |
| 753 | } else { |
| 754 | if (exists != nullptr) { |
| 755 | *exists = true; |
| 756 | } |
| 757 | FindHandleDeleter(&handle); |
| 758 | } |
| 759 | return Status::OK(); |
| 760 | } |
| 761 | |
| 762 | } // namespace |
| 763 |
no test coverage detected