From ee1807d8e3d09fffb9590d8de657c62eda236f16 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 29 Mar 2023 19:08:17 -0700 Subject: [PATCH] Don't use Bazel runfiles on for Python on Windows PiperOrigin-RevId: 520504539 --- mediapipe/tasks/cc/core/external_file_handler.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mediapipe/tasks/cc/core/external_file_handler.cc b/mediapipe/tasks/cc/core/external_file_handler.cc index 79234d55f..907a19f8b 100644 --- a/mediapipe/tasks/cc/core/external_file_handler.cc +++ b/mediapipe/tasks/cc/core/external_file_handler.cc @@ -44,9 +44,9 @@ limitations under the License. #include "mediapipe/tasks/cc/common.h" #include "mediapipe/tasks/cc/core/proto/external_file.pb.h" -#if defined(_WIN32) && !defined(PY_VERSION) +#ifdef _WIN32 #include "tools/cpp/runfiles/runfiles.h" -#endif // defined(_WIN32) && !defined(PY_VERSION) +#endif // _WIN32 namespace mediapipe { namespace tasks { @@ -97,8 +97,7 @@ ExternalFileHandler::CreateFromExternalFile( } absl::StatusOr PathToResourceAsFile(std::string path) { -#if !defined(_WIN32) || defined(PY_VERSION) - // Return the path directly if not on Windows or using Python +#ifndef _WIN32 return path; #else if (absl::StartsWith(path, "./")) { @@ -116,7 +115,7 @@ absl::StatusOr PathToResourceAsFile(std::string path) { return absl::InternalError("Unable to initialize runfiles: " + error); } return runfiles->Rlocation(path); -#endif // !defined(_WIN32) || defined(PY_VERSION) +#endif // _WIN32 } absl::Status ExternalFileHandler::MapExternalFile() {