Don't use Bazel runfiles on for Python on Windows

PiperOrigin-RevId: 520174325
This commit is contained in:
Sebastian Schmidt 2023-03-28 17:02:03 -07:00 committed by Copybara-Service
parent 9ee02481b1
commit dc132a5629

View File

@ -44,9 +44,9 @@ limitations under the License.
#include "mediapipe/tasks/cc/common.h"
#include "mediapipe/tasks/cc/core/proto/external_file.pb.h"
#ifdef _WIN32
#if defined(_WIN32) && !defined(PY_VERSION)
#include "tools/cpp/runfiles/runfiles.h"
#endif // _WIN32
#endif // defined(_WIN32) && !defined(PY_VERSION)
namespace mediapipe {
namespace tasks {
@ -97,7 +97,8 @@ ExternalFileHandler::CreateFromExternalFile(
}
absl::StatusOr<std::string> PathToResourceAsFile(std::string path) {
#ifndef _WIN32
#if !defined(_WIN32) || defined(PY_VERSION)
// Return the path directly if not on Windows or using Python
return path;
#else
if (absl::StartsWith(path, "./")) {
@ -115,7 +116,7 @@ absl::StatusOr<std::string> PathToResourceAsFile(std::string path) {
return absl::InternalError("Unable to initialize runfiles: " + error);
}
return runfiles->Rlocation(path);
#endif // _WIN32
#endif // !defined(_WIN32) || defined(PY_VERSION)
}
absl::Status ExternalFileHandler::MapExternalFile() {