Switch CHECK to a status in resource handling code. Expand error message.
PiperOrigin-RevId: 483438131
This commit is contained in:
parent
2cf9523468
commit
3d88b1797a
|
@ -82,7 +82,8 @@ absl::StatusOr<std::string> PathToResourceAsFile(const std::string& path) {
|
|||
// If that fails, assume it was a relative path, and try just the base name.
|
||||
{
|
||||
const size_t last_slash_idx = path.find_last_of("\\/");
|
||||
CHECK_NE(last_slash_idx, std::string::npos); // Make sure it's a path.
|
||||
RET_CHECK(last_slash_idx != std::string::npos)
|
||||
<< path << " doesn't have a slash in it"; // Make sure it's a path.
|
||||
auto base_name = path.substr(last_slash_idx + 1);
|
||||
auto status_or_path = PathToResourceAsFileInternal(base_name);
|
||||
if (status_or_path.ok()) {
|
||||
|
|
|
@ -71,7 +71,8 @@ absl::StatusOr<std::string> PathToResourceAsFile(const std::string& path) {
|
|||
// If that fails, assume it was a relative path, and try just the base name.
|
||||
{
|
||||
const size_t last_slash_idx = path.find_last_of("\\/");
|
||||
CHECK_NE(last_slash_idx, std::string::npos); // Make sure it's a path.
|
||||
RET_CHECK(last_slash_idx != std::string::npos)
|
||||
<< path << " doesn't have a slash in it"; // Make sure it's a path.
|
||||
auto base_name = path.substr(last_slash_idx + 1);
|
||||
auto status_or_path = PathToResourceAsFileInternal(base_name);
|
||||
if (status_or_path.ok()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user