mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
api: Moved file extension handling to plugin and added API
This commit is contained in:
@@ -42,6 +42,18 @@ namespace hex::plugin::builtin {
|
||||
EventManager::subscribe<EventFileUnloaded>(this, [this]{
|
||||
this->m_dataValid = false;
|
||||
});
|
||||
|
||||
ContentRegistry::FileHandler::add({ ".mgc" }, [](const auto &path) {
|
||||
for (auto &destPath : hex::getPath(ImHexPath::Magic)) {
|
||||
std::error_code error;
|
||||
if (fs::copy_file(path, destPath / path.filename(), fs::copy_options::overwrite_existing, error)) {
|
||||
View::showMessagePopup("hex.builtin.view.information.magic_db_added"_lang);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
ViewInformation::~ViewInformation() {
|
||||
|
||||
Reference in New Issue
Block a user