1
0
mirror of synced 2025-02-08 23:09:36 +01:00

fix: Windows system error messages not being encoded correctly

This commit is contained in:
WerWolv 2025-01-28 19:33:31 +01:00
parent 19a9786bbf
commit d45dd45720
4 changed files with 7 additions and 7 deletions

View File

@ -207,14 +207,14 @@ namespace hex::plugin::builtin {
m_diskHandle = ::open(path.c_str(), O_RDWR); m_diskHandle = ::open(path.c_str(), O_RDWR);
if (m_diskHandle == -1) { if (m_diskHandle == -1) {
this->setErrorMessage(hex::format("hex.builtin.provider.disk.error.read_rw"_lang, path, std::system_category().message(errno))); this->setErrorMessage(hex::format("hex.builtin.provider.disk.error.read_rw"_lang, path, formatSystemError(errno)));
log::warn(this->getErrorMessage()); log::warn(this->getErrorMessage());
m_diskHandle = ::open(path.c_str(), O_RDONLY); m_diskHandle = ::open(path.c_str(), O_RDONLY);
m_writable = false; m_writable = false;
} }
if (m_diskHandle == -1) { if (m_diskHandle == -1) {
this->setErrorMessage(hex::format("hex.builtin.provider.disk.error.read_ro"_lang, path, std::system_category().message(errno))); this->setErrorMessage(hex::format("hex.builtin.provider.disk.error.read_ro"_lang, path, formatSystemError(errno)));
log::warn(this->getErrorMessage()); log::warn(this->getErrorMessage());
m_readable = false; m_readable = false;
return false; return false;

View File

@ -204,7 +204,7 @@ namespace hex::plugin::builtin {
{ {
wolv::io::File file(m_path, wolv::io::File::Mode::Read); wolv::io::File file(m_path, wolv::io::File::Mode::Read);
if (!file.isValid()) { if (!file.isValid()) {
this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_path.string(), std::system_category().message(file.getOpenError().value_or(0)))); this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_path.string(), formatSystemError(file.getOpenError().value_or(0))));
return false; return false;
} }
@ -237,7 +237,7 @@ namespace hex::plugin::builtin {
file = wolv::io::File(m_path, wolv::io::File::Mode::Read); file = wolv::io::File(m_path, wolv::io::File::Mode::Read);
if (!file.isValid()) { if (!file.isValid()) {
m_readable = false; m_readable = false;
this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_path.string(), std::system_category().message(file.getOpenError().value_or(0)))); this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_path.string(), formatSystemError(file.getOpenError().value_or(0))));
return false; return false;
} }
@ -311,7 +311,7 @@ namespace hex::plugin::builtin {
fullPath = path; fullPath = path;
if (!wolv::io::fs::exists(fullPath)) { if (!wolv::io::fs::exists(fullPath)) {
this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_path.string(), std::system_category().message(ENOENT))); this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_path.string(), formatSystemError(ENOENT)));
} }
path = std::move(fullPath); path = std::move(fullPath);

View File

@ -197,7 +197,7 @@ namespace hex::plugin::builtin {
bool IntelHexProvider::open() { bool IntelHexProvider::open() {
auto file = wolv::io::File(m_sourceFilePath, wolv::io::File::Mode::Read); auto file = wolv::io::File(m_sourceFilePath, wolv::io::File::Mode::Read);
if (!file.isValid()) { if (!file.isValid()) {
this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_sourceFilePath.string(), std::system_category().message(errno))); this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_sourceFilePath.string(), formatSystemError(errno)));
return false; return false;
} }

View File

@ -174,7 +174,7 @@ namespace hex::plugin::builtin {
bool MotorolaSRECProvider::open() { bool MotorolaSRECProvider::open() {
auto file = wolv::io::File(m_sourceFilePath, wolv::io::File::Mode::Read); auto file = wolv::io::File(m_sourceFilePath, wolv::io::File::Mode::Read);
if (!file.isValid()) { if (!file.isValid()) {
this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_sourceFilePath.string(), std::system_category().message(errno))); this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_sourceFilePath.string(), formatSystemError(errno)));
return false; return false;
} }