CDImage: Log errno when fopen() fails

This commit is contained in:
Connor McLaughlin 2020-05-06 23:42:04 +10:00
parent 26e0177caa
commit df66d86b27
2 changed files with 6 additions and 4 deletions

View File

@ -2,6 +2,7 @@
#include "cd_subchannel_replacement.h"
#include "file_system.h"
#include "log.h"
#include <cerrno>
Log_SetChannel(CDImageBin);
class CDImageBin : public CDImage
@ -49,7 +50,7 @@ bool CDImageBin::Open(const char* filename)
m_fp = FileSystem::OpenCFile(filename, "rb");
if (!m_fp)
{
Log_ErrorPrintf("Failed to open binfile '%s'", filename);
Log_ErrorPrintf("Failed to open binfile '%s': errno %d", filename, errno);
return false;
}

View File

@ -4,6 +4,7 @@
#include "file_system.h"
#include "log.h"
#include <algorithm>
#include <cerrno>
#include <libcue/libcue.h>
#include <map>
Log_SetChannel(CDImageCueSheet);
@ -48,7 +49,7 @@ bool CDImageCueSheet::OpenAndParse(const char* filename)
std::FILE* cue_fp = FileSystem::OpenCFile(filename, "rb");
if (!cue_fp)
{
Log_ErrorPrintf("Failed to open cuesheet '%s'", filename);
Log_ErrorPrintf("Failed to open cuesheet '%s': errno %d", filename, errno);
return false;
}
@ -94,8 +95,8 @@ bool CDImageCueSheet::OpenAndParse(const char* filename)
std::FILE* track_fp = FileSystem::OpenCFile(track_full_filename.c_str(), "rb");
if (!track_fp)
{
Log_ErrorPrintf("Failed to open track filename '%s' (from '%s' and '%s')", track_full_filename.c_str(),
track_filename.c_str(), filename);
Log_ErrorPrintf("Failed to open track filename '%s' (from '%s' and '%s'): errno %d",
track_full_filename.c_str(), track_filename.c_str(), filename, errno);
return false;
}