Remove redundant quotes when printing filesystem paths

operator<< for std::filesystem::path already adds quotes around the
path so we don't need to keep manually quoting them.
This commit is contained in:
Chris Thrasher 2022-03-14 19:30:29 -06:00 committed by Lukas Dürrenberger
parent 79250d9584
commit d64cbff463
7 changed files with 22 additions and 22 deletions

View File

@ -74,7 +74,7 @@ std::unique_ptr<SoundFileReader> SoundFileFactory::createReaderFromFilename(cons
// Wrap the input file into a file stream // Wrap the input file into a file stream
FileInputStream stream; FileInputStream stream;
if (!stream.open(filename)) { if (!stream.open(filename)) {
err() << "Failed to open sound file \"" << filename << "\" (couldn't open stream)" << std::endl; err() << "Failed to open sound file " << filename << " (couldn't open stream)" << std::endl;
return nullptr; return nullptr;
} }
@ -92,7 +92,7 @@ std::unique_ptr<SoundFileReader> SoundFileFactory::createReaderFromFilename(cons
} }
// No suitable reader found // No suitable reader found
err() << "Failed to open sound file \"" << filename << "\" (format not supported)" << std::endl; err() << "Failed to open sound file " << filename << " (format not supported)" << std::endl;
return nullptr; return nullptr;
} }
@ -165,7 +165,7 @@ std::unique_ptr<SoundFileWriter> SoundFileFactory::createWriterFromFilename(cons
} }
// No suitable writer found // No suitable writer found
err() << "Failed to open sound file \"" << filename << "\" (format not supported)" << std::endl; err() << "Failed to open sound file " << filename << " (format not supported)" << std::endl;
return nullptr; return nullptr;
} }

View File

@ -68,7 +68,7 @@ bool SoundFileWriterFlac::open(const std::filesystem::path& filename, unsigned i
m_encoder = FLAC__stream_encoder_new(); m_encoder = FLAC__stream_encoder_new();
if (!m_encoder) if (!m_encoder)
{ {
err() << "Failed to write flac file \"" << filename << "\" (failed to allocate encoder)" << std::endl; err() << "Failed to write flac file " << filename << " (failed to allocate encoder)" << std::endl;
return false; return false;
} }
@ -80,7 +80,7 @@ bool SoundFileWriterFlac::open(const std::filesystem::path& filename, unsigned i
// Initialize the output stream // Initialize the output stream
if (FLAC__stream_encoder_init_file(m_encoder, filename.string().c_str(), nullptr, nullptr) != FLAC__STREAM_ENCODER_INIT_STATUS_OK) if (FLAC__stream_encoder_init_file(m_encoder, filename.string().c_str(), nullptr, nullptr) != FLAC__STREAM_ENCODER_INIT_STATUS_OK)
{ {
err() << "Failed to write flac file \"" << filename << "\" (failed to open the file)" << std::endl; err() << "Failed to write flac file " << filename << " (failed to open the file)" << std::endl;
close(); close();
return false; return false;
} }

View File

@ -79,7 +79,7 @@ bool SoundFileWriterOgg::open(const std::filesystem::path& filename, unsigned in
int status = vorbis_encode_init_vbr(&m_vorbis, static_cast<long>(channelCount), static_cast<long>(sampleRate), 0.4f); int status = vorbis_encode_init_vbr(&m_vorbis, static_cast<long>(channelCount), static_cast<long>(sampleRate), 0.4f);
if (status < 0) if (status < 0)
{ {
err() << "Failed to write ogg/vorbis file \"" << filename << "\" (unsupported bitrate)" << std::endl; err() << "Failed to write ogg/vorbis file " << filename << " (unsupported bitrate)" << std::endl;
close(); close();
return false; return false;
} }
@ -89,7 +89,7 @@ bool SoundFileWriterOgg::open(const std::filesystem::path& filename, unsigned in
m_file.open(filename.c_str(), std::ios::binary); m_file.open(filename.c_str(), std::ios::binary);
if (!m_file) if (!m_file)
{ {
err() << "Failed to write ogg/vorbis file \"" << filename << "\" (cannot open file)" << std::endl; err() << "Failed to write ogg/vorbis file " << filename << " (cannot open file)" << std::endl;
close(); close();
return false; return false;
} }
@ -104,7 +104,7 @@ bool SoundFileWriterOgg::open(const std::filesystem::path& filename, unsigned in
vorbis_comment_clear(&comment); vorbis_comment_clear(&comment);
if (status < 0) if (status < 0)
{ {
err() << "Failed to write ogg/vorbis file \"" << filename << "\" (cannot generate the headers)" << std::endl; err() << "Failed to write ogg/vorbis file " << filename << " (cannot generate the headers)" << std::endl;
close(); close();
return false; return false;
} }

View File

@ -102,14 +102,14 @@ bool SoundFileWriterWav::open(const std::filesystem::path& filename, unsigned in
m_file.open(filename.c_str(), std::ios::binary); m_file.open(filename.c_str(), std::ios::binary);
if (!m_file) if (!m_file)
{ {
err() << "Failed to open WAV sound file \"" << filename << "\" for writing" << std::endl; err() << "Failed to open WAV sound file " << filename << " for writing" << std::endl;
return false; return false;
} }
// Write the header // Write the header
if (!writeHeader(sampleRate, channelCount)) if (!writeHeader(sampleRate, channelCount))
{ {
err() << "Failed to write header of WAV sound file \"" << filename << '"' << std::endl; err() << "Failed to write header of WAV sound file " << filename << std::endl;
return false; return false;
} }

View File

@ -159,7 +159,7 @@ bool Font::loadFromFile(const std::filesystem::path& filename)
FT_Library library; FT_Library library;
if (FT_Init_FreeType(&library) != 0) if (FT_Init_FreeType(&library) != 0)
{ {
err() << "Failed to load font \"" << filename << "\" (failed to initialize FreeType)" << std::endl; err() << "Failed to load font " << filename << " (failed to initialize FreeType)" << std::endl;
return false; return false;
} }
fontHandles->library.reset(library); fontHandles->library.reset(library);
@ -168,7 +168,7 @@ bool Font::loadFromFile(const std::filesystem::path& filename)
FT_Face face; FT_Face face;
if (FT_New_Face(library, filename.string().c_str(), 0, &face) != 0) if (FT_New_Face(library, filename.string().c_str(), 0, &face) != 0)
{ {
err() << "Failed to load font \"" << filename << "\" (failed to create the font face)" << std::endl; err() << "Failed to load font " << filename << " (failed to create the font face)" << std::endl;
return false; return false;
} }
fontHandles->face.reset(face); fontHandles->face.reset(face);
@ -177,7 +177,7 @@ bool Font::loadFromFile(const std::filesystem::path& filename)
FT_Stroker stroker; FT_Stroker stroker;
if (FT_Stroker_New(library, &stroker) != 0) if (FT_Stroker_New(library, &stroker) != 0)
{ {
err() << "Failed to load font \"" << filename << "\" (failed to create the stroker)" << std::endl; err() << "Failed to load font " << filename << " (failed to create the stroker)" << std::endl;
return false; return false;
} }
fontHandles->stroker.reset(stroker); fontHandles->stroker.reset(stroker);
@ -185,7 +185,7 @@ bool Font::loadFromFile(const std::filesystem::path& filename)
// Select the unicode character map // Select the unicode character map
if (FT_Select_Charmap(face, FT_ENCODING_UNICODE) != 0) if (FT_Select_Charmap(face, FT_ENCODING_UNICODE) != 0)
{ {
err() << "Failed to load font \"" << filename << "\" (failed to set the Unicode character set)" << std::endl; err() << "Failed to load font " << filename << " (failed to set the Unicode character set)" << std::endl;
return false; return false;
} }

View File

@ -129,7 +129,7 @@ bool ImageLoader::loadImageFromFile(const std::filesystem::path& filename, std::
else else
{ {
// Error, failed to load the image // Error, failed to load the image
err() << "Failed to load image \"" << filename << "\". Reason: " << stbi_failure_reason() << std::endl; err() << "Failed to load image " << filename << ". Reason: " << stbi_failure_reason() << std::endl;
return false; return false;
} }
@ -277,7 +277,7 @@ bool ImageLoader::saveImageToFile(const std::filesystem::path& filename, const s
} }
} }
err() << "Failed to save image \"" << filename << '"' << std::endl; err() << "Failed to save image " << filename << std::endl;
return false; return false;
} }

View File

@ -259,7 +259,7 @@ bool Shader::loadFromFile(const std::filesystem::path& filename, Type type)
std::vector<char> shader; std::vector<char> shader;
if (!getFileContents(filename, shader)) if (!getFileContents(filename, shader))
{ {
err() << "Failed to open shader file \"" << filename << '"' << std::endl; err() << "Failed to open shader file " << filename << std::endl;
return false; return false;
} }
@ -280,7 +280,7 @@ bool Shader::loadFromFile(const std::filesystem::path& vertexShaderFilename, con
std::vector<char> vertexShader; std::vector<char> vertexShader;
if (!getFileContents(vertexShaderFilename, vertexShader)) if (!getFileContents(vertexShaderFilename, vertexShader))
{ {
err() << "Failed to open vertex shader file \"" << vertexShaderFilename << '"' << std::endl; err() << "Failed to open vertex shader file " << vertexShaderFilename << std::endl;
return false; return false;
} }
@ -288,7 +288,7 @@ bool Shader::loadFromFile(const std::filesystem::path& vertexShaderFilename, con
std::vector<char> fragmentShader; std::vector<char> fragmentShader;
if (!getFileContents(fragmentShaderFilename, fragmentShader)) if (!getFileContents(fragmentShaderFilename, fragmentShader))
{ {
err() << "Failed to open fragment shader file \"" << fragmentShaderFilename << '"' << std::endl; err() << "Failed to open fragment shader file " << fragmentShaderFilename << std::endl;
return false; return false;
} }
@ -304,7 +304,7 @@ bool Shader::loadFromFile(const std::filesystem::path& vertexShaderFilename, con
std::vector<char> vertexShader; std::vector<char> vertexShader;
if (!getFileContents(vertexShaderFilename, vertexShader)) if (!getFileContents(vertexShaderFilename, vertexShader))
{ {
err() << "Failed to open vertex shader file \"" << vertexShaderFilename << '"' << std::endl; err() << "Failed to open vertex shader file " << vertexShaderFilename << std::endl;
return false; return false;
} }
@ -312,7 +312,7 @@ bool Shader::loadFromFile(const std::filesystem::path& vertexShaderFilename, con
std::vector<char> geometryShader; std::vector<char> geometryShader;
if (!getFileContents(geometryShaderFilename, geometryShader)) if (!getFileContents(geometryShaderFilename, geometryShader))
{ {
err() << "Failed to open geometry shader file \"" << geometryShaderFilename << '"' << std::endl; err() << "Failed to open geometry shader file " << geometryShaderFilename << std::endl;
return false; return false;
} }
@ -320,7 +320,7 @@ bool Shader::loadFromFile(const std::filesystem::path& vertexShaderFilename, con
std::vector<char> fragmentShader; std::vector<char> fragmentShader;
if (!getFileContents(fragmentShaderFilename, fragmentShader)) if (!getFileContents(fragmentShaderFilename, fragmentShader))
{ {
err() << "Failed to open fragment shader file \"" << fragmentShaderFilename << '"' << std::endl; err() << "Failed to open fragment shader file " << fragmentShaderFilename << std::endl;
return false; return false;
} }