Merge pull request #14 from antopilo/feature/NK-73-creating-new-project-doesnt-add-project-suffix

Creating New Project doesn't add .project
This commit is contained in:
Antoine Pilote
2023-07-07 19:13:52 -04:00
committed by GitHub
4 changed files with 24 additions and 11 deletions

View File

@@ -1248,14 +1248,18 @@ namespace Nuake {
void NewProject()
{
if (Engine::GetProject())
if (Engine::GetProject() && Engine::GetProject()->FileExist())
Engine::GetProject()->Save();
std::string selectedProject = FileDialog::SaveFile("Project file\0*.project");
if (selectedProject == "") // Hit cancel
if(!String::EndsWith(selectedProject, ".project"))
selectedProject += ".project";
if (selectedProject.empty()) // Hit cancel
return;
Ref<Project> project = Project::New("Unnamed project", "no description", selectedProject + ".project");
Ref<Project> project = Project::New("Unnamed project", "no description", selectedProject);
Engine::LoadProject(project);
Engine::LoadScene(Scene::New());
}