Skip to content

Commit

Permalink
Allow CreateDirectoriesRecursively() to fail on report
Browse files Browse the repository at this point in the history
Only warn on failure to create path to report file.

When running in a semihosted ARM environment. There is no stat support nor mkdir, so existens checks for directories will always fail, however file open may still work.
  • Loading branch information
elupus committed Jun 1, 2023
1 parent 04cf298 commit f1c62fd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions googletest/src/gtest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,10 @@ static FILE* OpenFileForWriting(const std::string& output_file) {
FilePath output_file_path(output_file);
FilePath output_dir(output_file_path.RemoveFileName());

if (output_dir.CreateDirectoriesRecursively()) {
fileout = posix::FOpen(output_file.c_str(), "w");
if (!output_dir.CreateDirectoriesRecursively()) {
GTEST_LOG_(WARNING) << "Unable to create path to file \"" << output_file << "\"";
}
fileout = posix::FOpen(output_file.c_str(), "w");
if (fileout == nullptr) {
GTEST_LOG_(FATAL) << "Unable to open file \"" << output_file << "\"";
}
Expand Down

0 comments on commit f1c62fd

Please sign in to comment.