mirror of https://github.com/WerWolv/ImHex.git
feat: Added file handlers for .hexlyt and .hexproj files
This commit is contained in:
parent
456895a6a6
commit
99831a66a7
|
@ -28,6 +28,7 @@ add_library(${PROJECT_NAME} SHARED
|
|||
source/content/global_actions.cpp
|
||||
source/content/themes.cpp
|
||||
source/content/recent.cpp
|
||||
source/content/file_handlers.cpp
|
||||
|
||||
source/content/providers/file_provider.cpp
|
||||
source/content/providers/gdb_provider.cpp
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#include <hex/api/content_registry.hpp>
|
||||
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
void registerFileHandlers() {
|
||||
|
||||
ContentRegistry::FileHandler::add({ ".hexproj" }, [](const std::fs::path &path) {
|
||||
return ProjectFile::load(path);
|
||||
});
|
||||
|
||||
ContentRegistry::FileHandler::add({ ".hexlyt" }, [](const std::fs::path &path) {
|
||||
for (const auto &folder : fs::getDefaultPaths(fs::ImHexPath::Layouts)) {
|
||||
if (wolv::io::fs::copyFile(path, folder / path.filename()))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -30,6 +30,7 @@ namespace hex::plugin::builtin {
|
|||
void registerThemes();
|
||||
void registerBackgroundServices();
|
||||
void registerNetworkEndpoints();
|
||||
void registerFileHandlers();
|
||||
|
||||
void addFooterItems();
|
||||
void addTitleBarButtons();
|
||||
|
@ -69,6 +70,7 @@ IMHEX_PLUGIN_SETUP("Built-in", "WerWolv", "Default ImHex functionality") {
|
|||
registerThemes();
|
||||
registerBackgroundServices();
|
||||
registerNetworkEndpoints();
|
||||
registerFileHandlers();
|
||||
|
||||
addFooterItems();
|
||||
addTitleBarButtons();
|
||||
|
|
Loading…
Reference in New Issue