Don't use Bazel runfiles on for Python on Windows
PiperOrigin-RevId: 520504539
This commit is contained in:
parent
eaa708a18d
commit
ee1807d8e3
|
@ -44,9 +44,9 @@ limitations under the License.
|
||||||
#include "mediapipe/tasks/cc/common.h"
|
#include "mediapipe/tasks/cc/common.h"
|
||||||
#include "mediapipe/tasks/cc/core/proto/external_file.pb.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"
|
#include "tools/cpp/runfiles/runfiles.h"
|
||||||
#endif // defined(_WIN32) && !defined(PY_VERSION)
|
#endif // _WIN32
|
||||||
|
|
||||||
namespace mediapipe {
|
namespace mediapipe {
|
||||||
namespace tasks {
|
namespace tasks {
|
||||||
|
@ -97,8 +97,7 @@ ExternalFileHandler::CreateFromExternalFile(
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::StatusOr<std::string> PathToResourceAsFile(std::string path) {
|
absl::StatusOr<std::string> PathToResourceAsFile(std::string path) {
|
||||||
#if !defined(_WIN32) || defined(PY_VERSION)
|
#ifndef _WIN32
|
||||||
// Return the path directly if not on Windows or using Python
|
|
||||||
return path;
|
return path;
|
||||||
#else
|
#else
|
||||||
if (absl::StartsWith(path, "./")) {
|
if (absl::StartsWith(path, "./")) {
|
||||||
|
@ -116,7 +115,7 @@ absl::StatusOr<std::string> PathToResourceAsFile(std::string path) {
|
||||||
return absl::InternalError("Unable to initialize runfiles: " + error);
|
return absl::InternalError("Unable to initialize runfiles: " + error);
|
||||||
}
|
}
|
||||||
return runfiles->Rlocation(path);
|
return runfiles->Rlocation(path);
|
||||||
#endif // !defined(_WIN32) || defined(PY_VERSION)
|
#endif // _WIN32
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::Status ExternalFileHandler::MapExternalFile() {
|
absl::Status ExternalFileHandler::MapExternalFile() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user