diff --git a/lib/external/pattern_language b/lib/external/pattern_language index ca65dfcf7..f33fc83ce 160000 --- a/lib/external/pattern_language +++ b/lib/external/pattern_language @@ -1 +1 @@ -Subproject commit ca65dfcf75031f924f21a44ea5605432df6f7ffd +Subproject commit f33fc83cedb1e74bd4f583c90ff77b397e7b5c03 diff --git a/lib/libimhex/source/helpers/file.cpp b/lib/libimhex/source/helpers/file.cpp index cdd89b927..c14d8b530 100644 --- a/lib/libimhex/source/helpers/file.cpp +++ b/lib/libimhex/source/helpers/file.cpp @@ -6,13 +6,23 @@ namespace hex::fs { File::File(const std::fs::path &path, Mode mode) noexcept : m_path(path) { - if (mode == File::Mode::Read) - this->m_file = fopen64(path.string().c_str(), "rb"); - else if (mode == File::Mode::Write) - this->m_file = fopen64(path.string().c_str(), "r+b"); + #if defined(OS_WINDOWS) + if (mode == File::Mode::Read) + this->m_file = _wfopen(path.c_str(), L"rb"); + else if (mode == File::Mode::Write) + this->m_file = _wfopen(path.c_str(), L"r+b"); - if (mode == File::Mode::Create || (mode == File::Mode::Write && this->m_file == nullptr)) - this->m_file = fopen64(path.string().c_str(), "w+b"); + if (mode == File::Mode::Create || (mode == File::Mode::Write && this->m_file == nullptr)) + this->m_file = _wfopen(path.c_str(), L"w+b"); + #else + if (mode == File::Mode::Read) + this->m_file = fopen64(path.string().c_str(), "rb"); + else if (mode == File::Mode::Write) + this->m_file = fopen64(path.string().c_str(), "r+b"); + + if (mode == File::Mode::Create || (mode == File::Mode::Write && this->m_file == nullptr)) + this->m_file = fopen64(path.string().c_str(), "w+b"); + #endif } File::File() noexcept {