Skip to content

Commit 29e2366

Browse files
committed
hrmmm
1 parent 8e7ad94 commit 29e2366

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/basicio.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,6 +1641,20 @@ size_t writeFile(const DataBuf& buf, const std::string& path) {
16411641
}
16421642
return file.write(buf.c_data(), buf.size());
16431643
}
1644+
1645+
#ifdef _WIN32
1646+
DataBuf readFile(const std::wstring& path) {
1647+
FileIo file(path);
1648+
if (file.open("rb") != 0) {
1649+
throw Error(ErrorCode::kerFileOpenFailed, "rb", strError());
1650+
}
1651+
DataBuf buf(static_cast<size_t>(fs::file_size(path)));
1652+
if (file.read(buf.data(), buf.size()) != buf.size()) {
1653+
throw Error(ErrorCode::kerCallFailed, strError(), "FileIo::read");
1654+
}
1655+
return buf;
1656+
}
1657+
#endif
16441658
#endif
16451659

16461660
#ifdef EXV_USE_CURL

src/image.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ Image::UniquePtr ImageFactory::create(ImageType type, const std::string& path) {
903903
Image::UniquePtr ImageFactory::create(ImageType type, const std::wstring& path) {
904904
auto fileIo = std::make_unique<FileIo>(path);
905905
// Create or overwrite the file, then close it
906-
if (fileIo->open(L"w+b") != 0)
906+
if (fileIo->open("w+b") != 0)
907907
throw Error(ErrorCode::kerFileOpenFailed, "w+b", strError());
908908
fileIo->close();
909909

0 commit comments

Comments
 (0)