impr: Added better file open error messages to the file provider
This commit is contained in:
parent
470523cc86
commit
1c5a50c8d8
2
lib/external/libwolv
vendored
2
lib/external/libwolv
vendored
@ -1 +1 @@
|
||||
Subproject commit 6c26a4933891f997142b64572fe86d51cb36bff7
|
||||
Subproject commit ef8dd504a9173b0a2f25aa52563649e5777536cf
|
@ -202,8 +202,10 @@ namespace hex::plugin::builtin {
|
||||
size_t fileSize = 0x00;
|
||||
{
|
||||
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))));
|
||||
return false;
|
||||
}
|
||||
|
||||
fileSize = file.getSize();
|
||||
}
|
||||
@ -231,11 +233,6 @@ namespace hex::plugin::builtin {
|
||||
m_readable = true;
|
||||
m_writable = true;
|
||||
|
||||
if (!wolv::io::fs::exists(m_path)) {
|
||||
this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_path.string(), std::system_category().message(ENOENT)));
|
||||
return false;
|
||||
}
|
||||
|
||||
wolv::io::File file(m_path, wolv::io::File::Mode::Write);
|
||||
if (!file.isValid()) {
|
||||
m_writable = false;
|
||||
@ -243,7 +240,7 @@ namespace hex::plugin::builtin {
|
||||
file = wolv::io::File(m_path, wolv::io::File::Mode::Read);
|
||||
if (!file.isValid()) {
|
||||
m_readable = false;
|
||||
this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_path.string(), std::system_category().message(errno)));
|
||||
this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_path.string(), std::system_category().message(file.getOpenError().value_or(0))));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user