fix: Issues when opening files with unicode names
This commit is contained in:
parent
1f433fc36d
commit
19f99bab0c
2
lib/external/pattern_language
vendored
2
lib/external/pattern_language
vendored
@ -1 +1 @@
|
|||||||
Subproject commit ca65dfcf75031f924f21a44ea5605432df6f7ffd
|
Subproject commit f33fc83cedb1e74bd4f583c90ff77b397e7b5c03
|
@ -6,6 +6,15 @@
|
|||||||
namespace hex::fs {
|
namespace hex::fs {
|
||||||
|
|
||||||
File::File(const std::fs::path &path, Mode mode) noexcept : m_path(path) {
|
File::File(const std::fs::path &path, Mode mode) noexcept : m_path(path) {
|
||||||
|
#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 = _wfopen(path.c_str(), L"w+b");
|
||||||
|
#else
|
||||||
if (mode == File::Mode::Read)
|
if (mode == File::Mode::Read)
|
||||||
this->m_file = fopen64(path.string().c_str(), "rb");
|
this->m_file = fopen64(path.string().c_str(), "rb");
|
||||||
else if (mode == File::Mode::Write)
|
else if (mode == File::Mode::Write)
|
||||||
@ -13,6 +22,7 @@ namespace hex::fs {
|
|||||||
|
|
||||||
if (mode == File::Mode::Create || (mode == File::Mode::Write && this->m_file == nullptr))
|
if (mode == File::Mode::Create || (mode == File::Mode::Write && this->m_file == nullptr))
|
||||||
this->m_file = fopen64(path.string().c_str(), "w+b");
|
this->m_file = fopen64(path.string().c_str(), "w+b");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
File::File() noexcept {
|
File::File() noexcept {
|
||||||
|
Loading…
Reference in New Issue
Block a user