Commit fb62a1fc authored by Hal Finkel's avatar Hal Finkel
Browse files

The error should not say create if we did not try to create

parent 2fb90def
......@@ -92,8 +92,8 @@ void GenericFileIO_MPI::open(const std::string &FN, bool ForReading, bool MustEx
(!MustExist ? MPI_MODE_CREATE : 0));
if (MPI_File_open(Comm, const_cast<char *>(FileName.c_str()), amode,
MPI_INFO_NULL, &FH) != MPI_SUCCESS)
throw runtime_error((!ForReading ? "Unable to create the file: " :
"Unable to open the file: ") +
throw runtime_error(((!ForReading && !MustExist) ? "Unable to create the file: " :
"Unable to open the file: ") +
FileName);
}
......@@ -193,8 +193,8 @@ void GenericFileIO_POSIX::open(const std::string &FN, bool ForReading, bool Must
int mode = S_IRUSR | S_IWUSR | S_IRGRP;
errno = 0;
if ((FH = ::open(FileName.c_str(), flags, mode)) == -1)
throw runtime_error((!ForReading ? "Unable to create the file: " :
"Unable to open the file: ") +
throw runtime_error(((!ForReading && !MustExist) ? "Unable to create the file: " :
"Unable to open the file: ") +
FileName + ": " + strerror(errno));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment