Use std::filesystem::path::string() when writing paths to std::cout/std::cerr

Otherwise they will be quoted, which is not desirable, especially under
Windows (backslashes will be duplicated).
master
Sébastien Villemot 2022-10-11 11:00:50 +02:00
parent e0b2583ff9
commit 5b400b69f0
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
4 changed files with 6 additions and 6 deletions

View File

@ -372,7 +372,7 @@ DynamicModel::writeDynamicPerBlockCFiles(const string &basename, const string &m
ofstream output{filename, ios::out | ios::binary};
if (!output.is_open())
{
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
cerr << "ERROR: Can't open file " << filename.string() << " for writing" << endl;
exit(EXIT_FAILURE);
}
@ -543,7 +543,7 @@ DynamicModel::writeDynamicPerBlockCFiles(const string &basename, const string &m
ofstream header_output{filename, ios::out | ios::binary};
if (!header_output.is_open())
{
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
cerr << "ERROR: Can't open file " << filename.string() << " for writing" << endl;
exit(EXIT_FAILURE);
}
header_output << header.str() << ';' << endl;
@ -4605,7 +4605,7 @@ DynamicModel::isChecksumMatching(const string &basename) const
checksum_file.open(filename, ios::out | ios::binary);
if (!checksum_file.is_open())
{
cerr << "ERROR: Can't open file " << filename << endl;
cerr << "ERROR: Can't open file " << filename.string() << endl;
exit(EXIT_FAILURE);
}
checksum_file << result;

View File

@ -1759,7 +1759,7 @@ ModelTree::compileMEX(const filesystem::path &output_dir, const string &output_b
cmd << '"';
#endif
cout << "Compiling " << output_filename << endl;
cout << "Compiling " << output_filename.string() << endl;
// The prerequisites are the object files among the input files
set<filesystem::path> prerequisites;

View File

@ -837,7 +837,7 @@ ModelTree::writeModelCFile(const string &basename, const string &mexext,
output.open(p, ios::out | ios::binary);
if (!output.is_open())
{
cerr << "ERROR: Can't open file " << p << " for writing" << endl;
cerr << "ERROR: Can't open file " << p.string() << " for writing" << endl;
exit(EXIT_FAILURE);
}
};

View File

@ -167,7 +167,7 @@ StaticModel::writeStaticPerBlockCFiles(const string &basename, const string &mex
ofstream output{filename, ios::out | ios::binary};
if (!output.is_open())
{
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
cerr << "ERROR: Can't open file " << filename.string() << " for writing" << endl;
exit(EXIT_FAILURE);
}
output << "/* Block " << blk+1 << endl