mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-09 20:08:57 +03:00
Merge pull request #15 from antopilo/feature/NK-85-creating-project-editor-doesnt-create-folder
Creating New Project Editor does not create directory
This commit is contained in:
@@ -1258,10 +1258,27 @@ 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 = 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 = Project::New(String::Split(fileName, '.')[0], "no description", finalPath);
|
||||
Engine::LoadProject(project);
|
||||
Engine::LoadScene(Scene::New());
|
||||
|
||||
Engine::GetCurrentWindow()->SetTitle("Nuake Engine - Editing " + project->Name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user