Creating New Project doesn't add .project

This commit is contained in:
emerycp
2023-07-07 18:24:55 -04:00
parent 53e5e9e071
commit 1885f1a853
4 changed files with 25 additions and 11 deletions

View File

@@ -1248,14 +1248,18 @@ namespace Nuake {
void NewProject()
{
if (Engine::GetProject())
if (Engine::GetProject() && Engine::GetProject()->Exist())
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());
}