mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 21:05:56 -05:00
impr: Remove hex::format, improve format and logging type safety
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user