fix: Default magic database not being bundled correctly

This commit is contained in:
WerWolv
2024-01-30 21:19:43 +01:00
parent d5365fbf0c
commit 10f6aa3e4e
4 changed files with 23 additions and 2 deletions

View File

@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
include(ImHexPlugin)
find_file(DEFAULT_MAGIC_FILE_PATH magic.mgc HINTS ${MAGIC_INCLUDE_DIRS}/../share/misc)
find_file(DEFAULT_MAGIC_FILE_PATH magic.mgc HINTS ${LIBMAGIC_INCLUDE_DIR}/../share/misc)
if (DEFAULT_MAGIC_FILE_PATH)
add_romfs_resource(${DEFAULT_MAGIC_FILE_PATH} always_auto_extract/magic/magic.mgc)
endif ()

View File

@@ -3,6 +3,8 @@
#include <wolv/io/file.hpp>
#include <romfs/romfs.hpp>
#include <hex/helpers/logger.hpp>
namespace hex::plugin::builtin {
void extractBundledFiles() {
@@ -17,6 +19,7 @@ namespace hex::plugin::builtin {
for (const auto &romfsPath : romfs::list(extractFolder)) {
for (const auto &imhexPath : fs::getDataPaths()) {
const auto path = imhexPath / std::fs::relative(romfsPath, extractFolder);
log::info("Extracting {} to {}", romfsPath.string(), path.string());
if (!alwaysExtract && wolv::io::fs::exists(path))
continue;