Win32 file-exclusivity fix.

This commit is contained in:
casey langen 2019-02-01 11:57:36 -08:00
parent 567c7a698c
commit 2023e43c62

View File

@ -154,9 +154,15 @@ static TagLib::FileRef resolveOggType(const char* uri) {
std::begin(OGG_OPUS_HEADER), std::end(OGG_OPUS_HEADER));
if (it != std::end(buffer)) {
#ifdef WIN32
const std::wstring uri16 = utf8to16(uri);
return TagLib::FileRef(new TagLib::Ogg::Opus::File(uri16.c_str()));
#else
return TagLib::FileRef(new TagLib::Ogg::Opus::File(uri));
#endif
}
}
}
}
catch (...) {
@ -277,6 +283,7 @@ bool TaglibMetadataReader::ReadGeneric(
assumes it's a vorbis file. in this case, we'll read the header
and try to guess the filetype */
if (file.isNull() && extension == "ogg") {
file = TagLib::FileRef(); /* closes the file */
file = resolveOggType(uri);
}