Fix wide-string support for wav-file reader.
This commit is contained in:
@@ -380,17 +380,22 @@ ALvoid* loadWAVFromFile(const SGPath& path, unsigned int& format, ALsizei& size,
|
|||||||
if (!path.exists()) {
|
if (!path.exists()) {
|
||||||
throw sg_io_exception("loadWAVFromFile: file not found", path);
|
throw sg_io_exception("loadWAVFromFile: file not found", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer b;
|
Buffer b;
|
||||||
b.path = path;
|
b.path = path;
|
||||||
|
|
||||||
gzFile fd;
|
gzFile fd;
|
||||||
std::string ps = path.local8BitStr();
|
#if defined(SG_WINDOWS)
|
||||||
|
std::wstring ws = path.wstr();
|
||||||
|
fd = gzopen_w(ws.c_str(), "rb");
|
||||||
|
#else
|
||||||
|
std::string ps = path.utf8Str();
|
||||||
fd = gzopen(ps.c_str(), "rb");
|
fd = gzopen(ps.c_str(), "rb");
|
||||||
|
#endif
|
||||||
if (!fd) {
|
if (!fd) {
|
||||||
throw sg_io_exception("loadWAVFromFile: unable to open file", path);
|
throw sg_io_exception("loadWAVFromFile: unable to open file", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loadWavFile(fd, &b);
|
loadWavFile(fd, &b);
|
||||||
} catch (sg_exception& e) {
|
} catch (sg_exception& e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user