mirror of
https://github.com/arabine/open-story-teller.git
synced 2025-12-06 17:09:06 +01:00
Fix open exiting module
This commit is contained in:
parent
03fc21dd17
commit
d2fac4d79e
2 changed files with 6 additions and 5 deletions
|
|
@ -158,16 +158,20 @@ public:
|
|||
if (entry.is_directory())
|
||||
{
|
||||
std::cout << "Scanning directory: " << entry.path() << std::endl;
|
||||
auto uuid = entry.path().filename().string();
|
||||
for (const auto& subEntry : std::filesystem::directory_iterator(entry.path()))
|
||||
{
|
||||
if (subEntry.is_regular_file() && subEntry.path().extension() == ".json")
|
||||
{
|
||||
std::cout << "Found module file: " << subEntry.path() << std::endl;
|
||||
|
||||
auto p = std::make_shared<StoryProject>(m_log);
|
||||
|
||||
p->SetPaths(uuid, m_rootPath);
|
||||
// Load the JSON file and register a node based on its content
|
||||
std::ifstream file(subEntry.path());
|
||||
nlohmann::json j;
|
||||
file >> j;
|
||||
auto p = std::make_shared<StoryProject>(m_log);
|
||||
p->ParseStoryInformation(j);
|
||||
if (p->IsModule())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -909,18 +909,15 @@ void MainWindow::OpenModule(const std::string &uuid)
|
|||
{
|
||||
Log("Open module success");
|
||||
m_moduleEditorWindow.Load(m_module);
|
||||
m_moduleEditorWindow.Enable();
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("Open module error");
|
||||
}
|
||||
|
||||
|
||||
m_moduleEditorWindow.Enable();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::CloseProject()
|
||||
{
|
||||
// FIXME: not sure but if present, we lost some information in the library manager
|
||||
|
|
|
|||
Loading…
Reference in a new issue