build: Always extract magic file database
This commit is contained in:
parent
b64bb3bec9
commit
03dc26d2d4
@ -4,7 +4,7 @@ include(ImHexPlugin)
|
||||
|
||||
find_file(DEFAULT_MAGIC_FILE_PATH magic.mgc HINTS ${MAGIC_INCLUDE_DIRS}/../share/misc)
|
||||
if (DEFAULT_MAGIC_FILE_PATH)
|
||||
add_romfs_resource(${DEFAULT_MAGIC_FILE_PATH} auto_extract/magic/magic.mgc)
|
||||
add_romfs_resource(${DEFAULT_MAGIC_FILE_PATH} always_auto_extract/magic/magic.mgc)
|
||||
endif ()
|
||||
|
||||
add_imhex_plugin(
|
||||
|
@ -6,10 +6,18 @@
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
void extractBundledFiles() {
|
||||
for (const auto &romfsPath : romfs::list("auto_extract")) {
|
||||
constexpr static std::array<std::pair<std::string_view, bool>, 2> Paths = {
|
||||
{
|
||||
{ "auto_extract", false },
|
||||
{ "always_auto_extract", true }
|
||||
}
|
||||
};
|
||||
|
||||
for (const auto [extractFolder, alwaysExtract] : Paths) {
|
||||
for (const auto &romfsPath : romfs::list(extractFolder)) {
|
||||
for (const auto &imhexPath : fs::getDataPaths()) {
|
||||
const auto path = imhexPath / std::fs::relative(romfsPath, "auto_extract");
|
||||
if (wolv::io::fs::exists(path))
|
||||
const auto path = imhexPath / std::fs::relative(romfsPath, extractFolder);
|
||||
if (!alwaysExtract && wolv::io::fs::exists(path))
|
||||
continue;
|
||||
|
||||
wolv::io::File file(path, wolv::io::File::Mode::Create);
|
||||
@ -25,5 +33,6 @@ namespace hex::plugin::builtin {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user