2023-12-11 15:54:22 +01:00
|
|
|
#include <hex/api/content_registry.hpp>
|
2023-12-12 00:16:21 +01:00
|
|
|
#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() {
|
2024-02-11 14:12:14 +01:00
|
|
|
WorkspaceManager::reset();
|
|
|
|
|
2023-12-11 15:54:22 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-03 12:16:36 +01:00
|
|
|
std::string currentWorkspace = ContentRegistry::Settings::read<std::string>("hex.builtin.setting.general", "hex.builtin.setting.general.curr_workspace", "Default");
|
2023-12-12 00:16:21 +01:00
|
|
|
|
|
|
|
TaskManager::doLater([currentWorkspace] {
|
|
|
|
WorkspaceManager::switchWorkspace(currentWorkspace);
|
|
|
|
});
|
2023-12-11 15:54:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|