From 1e81cb853204610177788dab52f22b04d29892bd Mon Sep 17 00:00:00 2001 From: emerycp Date: Fri, 7 Jul 2023 22:25:42 -0400 Subject: [PATCH 1/2] Creating Project Editor does not create directory --- Editor/src/Windows/EditorInterface.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index ecff9d88..b13aaad8 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -1258,8 +1258,23 @@ namespace Nuake { if (selectedProject.empty()) // Hit cancel return; + + auto backslashSplits = String::Split(selectedProject, '\\'); + auto fileName = backslashSplits[backslashSplits.size() - 1]; + + std::string finalPath = String::Split(selectedProject, '.')[0]; - Ref project = Project::New("Unnamed project", "no description", selectedProject); + // We need to create a folder + if (const auto& dirPath = finalPath; + !std::filesystem::create_directory(dirPath)) + { + // Should we continue? + Logger::Log("Failed creating project directory: " + dirPath); + } + + finalPath += "\\" + fileName; + + Ref project = Project::New(String::Split(fileName, '.')[0], "no description", finalPath); Engine::LoadProject(project); Engine::LoadScene(Scene::New()); } From ef74b3f99801431133959ced036cf46132f99230 Mon Sep 17 00:00:00 2001 From: emerycp Date: Fri, 7 Jul 2023 22:42:37 -0400 Subject: [PATCH 2/2] Change Title on New Project --- Editor/src/Windows/EditorInterface.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index b13aaad8..67ec3268 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -1277,6 +1277,8 @@ namespace Nuake { Ref project = Project::New(String::Split(fileName, '.')[0], "no description", finalPath); Engine::LoadProject(project); Engine::LoadScene(Scene::New()); + + Engine::GetCurrentWindow()->SetTitle("Nuake Engine - Editing " + project->Name); }