1
0
mirror of synced 2024-11-29 18:04:30 +01:00
ImHex/plugins/builtin/source/content/workspaces.cpp

31 lines
966 B
C++
Raw Normal View History

2023-12-11 15:54:22 +01:00
#include <hex/api/content_registry.hpp>
#include <hex/api/task_manager.hpp>
2023-12-11 15:54:22 +01:00
#include <hex/api/workspace_manager.hpp>
#include <hex/helpers/fs.hpp>
namespace hex::plugin::builtin {
void loadWorkspaces() {
for (const auto &defaultPath : fs::getDefaultPaths(fs::ImHexPath::Workspaces)) {
for (const auto &entry : std::fs::directory_iterator(defaultPath)) {
if (!entry.is_regular_file())
continue;
const auto &path = entry.path();
if (path.extension() != ".hexws")
continue;
WorkspaceManager::importFromFile(path);
}
}
std::string currentWorkspace = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.curr_workspace", "Default");
TaskManager::doLater([currentWorkspace] {
WorkspaceManager::switchWorkspace(currentWorkspace);
});
2023-12-11 15:54:22 +01:00
}
}