1
0
mirror of synced 2024-11-15 03:27:40 +01:00
ImHex/plugins/builtin/source/content/file_extraction.cpp
2023-12-11 15:54:22 +01:00

26 lines
713 B
C++

#include <hex/helpers/fs.hpp>
#include <wolv/io/file.hpp>
#include <romfs/romfs.hpp>
namespace hex::plugin::builtin {
void extractBundledFiles() {
for (const auto &romfsPath : romfs::list("auto_extract")) {
for (const auto &imhexPath : fs::getDataPaths()) {
wolv::io::File file(imhexPath / std::fs::relative(romfsPath, "auto_extract"), wolv::io::File::Mode::Create);
if (!file.isValid())
continue;
auto data = romfs::get(romfsPath).span<u8>();
file.writeBuffer(data.data(), data.size());
if (file.getSize() == data.size())
break;
}
}
}
}