diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index d034367eb..332cd92d6 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -616,7 +616,7 @@ macro(addBundledLibraries) enableUnityBuild(libpl) find_package(mbedTLS 3.4.0 REQUIRED) - find_library(MAGIC 5.39 magic REQUIRED) + find_package(Magic 5.39 REQUIRED) if (NOT IMHEX_DISABLE_STACKTRACE) if (WIN32) diff --git a/cmake/modules/FindMagic.cmake b/cmake/modules/FindMagic.cmake new file mode 100644 index 000000000..936701be7 --- /dev/null +++ b/cmake/modules/FindMagic.cmake @@ -0,0 +1,18 @@ +find_path(LIBMAGIC_INCLUDE_DIR magic.h) + +find_library(LIBMAGIC_LIBRARY NAMES magic) + +if (LIBMAGIC_INCLUDE_DIR AND LIBMAGIC_LIBRARY) + set(LIBMAGIC_FOUND TRUE) +endif (LIBMAGIC_INCLUDE_DIR AND LIBMAGIC_LIBRARY) + +find_package_handle_standard_args("libmagic" DEFAULT_MSG + LIBMAGIC_LIBRARY + LIBMAGIC_INCLUDE_DIR +) + +mark_as_advanced( + LIBMAGIC_INCLUDE_DIR + LIBMAGIC_LIBRARY + LIBMAGIC_FOUND +) \ No newline at end of file diff --git a/plugins/builtin/CMakeLists.txt b/plugins/builtin/CMakeLists.txt index b998cba50..82596c28f 100644 --- a/plugins/builtin/CMakeLists.txt +++ b/plugins/builtin/CMakeLists.txt @@ -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 () diff --git a/plugins/builtin/source/content/file_extraction.cpp b/plugins/builtin/source/content/file_extraction.cpp index 66f928a91..aebf50c43 100644 --- a/plugins/builtin/source/content/file_extraction.cpp +++ b/plugins/builtin/source/content/file_extraction.cpp @@ -3,6 +3,8 @@ #include #include +#include + 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;