Don't error in ExternalFile handler on Windows if FileContent is provided

PiperOrigin-RevId: 504069137
This commit is contained in:
Sebastian Schmidt 2023-01-23 13:36:32 -08:00 committed by Copybara-Service
parent 69d354fc89
commit ccd1461add

View File

@ -84,12 +84,6 @@ ExternalFileHandler::CreateFromExternalFile(
} }
absl::Status ExternalFileHandler::MapExternalFile() { absl::Status ExternalFileHandler::MapExternalFile() {
// TODO: Add Windows support
#ifdef _WIN32
return CreateStatusWithPayload(StatusCode::kFailedPrecondition,
"File loading is not yet supported on Windows",
MediaPipeTasksStatus::kFileReadError);
#else
if (!external_file_.file_content().empty()) { if (!external_file_.file_content().empty()) {
return absl::OkStatus(); return absl::OkStatus();
} else if (external_file_.has_file_pointer_meta()) { } else if (external_file_.has_file_pointer_meta()) {
@ -106,6 +100,13 @@ absl::Status ExternalFileHandler::MapExternalFile() {
} }
return absl::OkStatus(); return absl::OkStatus();
} }
// TODO: Add Windows support
#ifdef _WIN32
return CreateStatusWithPayload(StatusCode::kFailedPrecondition,
"File loading is not yet supported on Windows",
MediaPipeTasksStatus::kFileReadError);
#else
if (external_file_.file_name().empty() && if (external_file_.file_name().empty() &&
!external_file_.has_file_descriptor_meta()) { !external_file_.has_file_descriptor_meta()) {
return CreateStatusWithPayload( return CreateStatusWithPayload(