Project import generated by Copybara.
GitOrigin-RevId: ea8d45731f5a052f79745e35bfd8240d6ac568d2
This commit is contained in:
@@ -33,8 +33,9 @@ mediapipe::StatusOr<std::string> PathToResourceAsFile(const std::string& path) {
|
||||
}
|
||||
|
||||
mediapipe::Status GetResourceContents(const std::string& path,
|
||||
std::string* output) {
|
||||
return mediapipe::file::GetContents(path, output);
|
||||
std::string* output,
|
||||
bool read_as_binary) {
|
||||
return mediapipe::file::GetContents(path, output, read_as_binary);
|
||||
}
|
||||
|
||||
} // namespace mediapipe
|
||||
|
||||
@@ -44,7 +44,8 @@ mediapipe::StatusOr<std::string> PathToResourceAsFile(const std::string& path);
|
||||
// Reads the entire contents of a resource. The search path is as in
|
||||
// PathToResourceAsFile.
|
||||
mediapipe::Status GetResourceContents(const std::string& path,
|
||||
std::string* output);
|
||||
std::string* output,
|
||||
bool read_as_binary = true);
|
||||
|
||||
} // namespace mediapipe
|
||||
|
||||
|
||||
@@ -57,7 +57,12 @@ mediapipe::StatusOr<std::string> PathToResourceAsFile(const std::string& path) {
|
||||
}
|
||||
|
||||
mediapipe::Status GetResourceContents(const std::string& path,
|
||||
std::string* output) {
|
||||
std::string* output,
|
||||
bool read_as_binary) {
|
||||
if (!read_as_binary) {
|
||||
LOG(WARNING)
|
||||
<< "Setting \"read_as_binary\" to false is a no-op on Android.";
|
||||
}
|
||||
if (absl::StartsWith(path, "/")) {
|
||||
return file::GetContents(path, output, file::Defaults());
|
||||
}
|
||||
|
||||
@@ -66,7 +66,11 @@ mediapipe::StatusOr<std::string> PathToResourceAsFile(const std::string& path) {
|
||||
}
|
||||
|
||||
mediapipe::Status GetResourceContents(const std::string& path,
|
||||
std::string* output) {
|
||||
std::string* output,
|
||||
bool read_as_binary) {
|
||||
if (!read_as_binary) {
|
||||
LOG(WARNING) << "Setting \"read_as_binary\" to false is a no-op on ios.";
|
||||
}
|
||||
ASSIGN_OR_RETURN(std::string full_path, PathToResourceAsFile(path));
|
||||
|
||||
std::ifstream input_file(full_path);
|
||||
|
||||
Reference in New Issue
Block a user