impr: Remove hex::format, improve format and logging type safety

This commit is contained in:
WerWolv
2025-08-06 20:01:58 +02:00
parent d429424f67
commit 9cff9043ee
109 changed files with 473 additions and 455 deletions

View File

@@ -24,8 +24,8 @@ namespace hex::plugin::builtin {
bool load(const std::fs::path &filePath) {
if (!wolv::io::fs::exists(filePath) || !wolv::io::fs::isRegularFile(filePath)) {
ui::ToastError::open(hex::format("hex.builtin.popup.error.project.load"_lang,
hex::format("hex.builtin.popup.error.project.load.file_not_found"_lang,
ui::ToastError::open(fmt::format("hex.builtin.popup.error.project.load"_lang,
fmt::format("hex.builtin.popup.error.project.load.file_not_found"_lang,
wolv::util::toUTF8String(filePath)
)));
@@ -34,8 +34,8 @@ namespace hex::plugin::builtin {
Tar tar(filePath, Tar::Mode::Read);
if (!tar.isValid()) {
ui::ToastError::open(hex::format("hex.builtin.popup.error.project.load"_lang,
hex::format("hex.builtin.popup.error.project.load.invalid_tar"_lang,
ui::ToastError::open(fmt::format("hex.builtin.popup.error.project.load"_lang,
fmt::format("hex.builtin.popup.error.project.load.invalid_tar"_lang,
tar.getOpenErrorString()
)));
@@ -43,8 +43,8 @@ namespace hex::plugin::builtin {
}
if (!tar.contains(MetadataPath)) {
ui::ToastError::open(hex::format("hex.builtin.popup.error.project.load"_lang,
hex::format("hex.builtin.popup.error.project.load.invalid_magic"_lang)
ui::ToastError::open(fmt::format("hex.builtin.popup.error.project.load"_lang,
fmt::format("hex.builtin.popup.error.project.load.invalid_magic"_lang)
));
return false;
@@ -54,8 +54,8 @@ namespace hex::plugin::builtin {
const auto metadataContent = tar.readVector(MetadataPath);
if (!std::string(metadataContent.begin(), metadataContent.end()).starts_with(MetadataHeaderMagic)) {
ui::ToastError::open(hex::format("hex.builtin.popup.error.project.load"_lang,
hex::format("hex.builtin.popup.error.project.load.invalid_magic"_lang)
ui::ToastError::open(fmt::format("hex.builtin.popup.error.project.load"_lang,
fmt::format("hex.builtin.popup.error.project.load.invalid_magic"_lang)
));
return false;
@@ -159,7 +159,7 @@ namespace hex::plugin::builtin {
}
{
const auto metadataContent = hex::format("{}\n{}", MetadataHeaderMagic, ImHexApi::System::getImHexVersion().get(false));
const auto metadataContent = fmt::format("{}\n{}", MetadataHeaderMagic, ImHexApi::System::getImHexVersion().get(false));
tar.writeString(MetadataPath, metadataContent);
}