Add better logging for file open and write errors
This commit is contained in:
@@ -281,7 +281,7 @@ SongLoader::Result SongLoader::LoadLocalAsync(const QString &filename) {
|
||||
// It's a local file, so check if it looks like a playlist. Read the first few bytes.
|
||||
QFile file(filename);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
errors_ << tr("Could not open file %1").arg(filename);
|
||||
errors_ << tr("Could not open file %1 for reading: %2").arg(filename).arg(file.errorString());
|
||||
return Error;
|
||||
}
|
||||
QByteArray data(file.read(PlaylistParser::kMagicSize));
|
||||
@@ -312,6 +312,10 @@ SongLoader::Result SongLoader::LoadLocalAsync(const QString &filename) {
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
else {
|
||||
errors_ << tr("Could not open CUE file %1 for reading: %2").arg(matching_cue).arg(cue.errorString());
|
||||
return Error;
|
||||
}
|
||||
}
|
||||
|
||||
// Assume it's just a normal file
|
||||
@@ -364,6 +368,9 @@ void SongLoader::LoadPlaylist(ParserBase *parser, const QString &filename) {
|
||||
songs_ = parser->Load(&file, filename, QFileInfo(filename).path());
|
||||
file.close();
|
||||
}
|
||||
else {
|
||||
errors_ << tr("Could not open playlist file %1 for reading: %2").arg(filename).arg(file.errorString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user