Fix mediapipe::file::Exists() for >2GB files on Windows.

PiperOrigin-RevId: 660497728
This commit is contained in:
MediaPipe Team 2024-08-07 12:41:16 -07:00 committed by Copybara-Service
parent 0ed6e57b90
commit 14b8a02c13

View File

@ -259,9 +259,14 @@ absl::Status MatchFileTypeInDirectory(const std::string& directory,
}
absl::Status Exists(absl::string_view file_name) {
#ifdef _WIN32
// Windows needs to use stat64 for >2GB files.
struct _stat64 buffer;
int status = _stat64(std::string(file_name).c_str(), &buffer);
#else
struct stat buffer;
int status;
status = stat(std::string(file_name).c_str(), &buffer);
int status = stat(std::string(file_name).c_str(), &buffer);
#endif
if (status == 0) {
return absl::OkStatus();
}