diff --git a/Editor/src/Windows/WelcomeWindow.cpp b/Editor/src/Windows/WelcomeWindow.cpp index 93958ba2..06873e3a 100644 --- a/Editor/src/Windows/WelcomeWindow.cpp +++ b/Editor/src/Windows/WelcomeWindow.cpp @@ -167,40 +167,32 @@ namespace Nuake { std::string selectedProject = FileDialog::SaveFile("Project file\0*.project"); - std::string projectPathWithExtension = selectedProject; - const bool endsWithExtension = String::EndsWith(projectPathWithExtension, ".project"); - if(!endsWithExtension) - { - projectPathWithExtension += ".project"; - } + auto backslashSplits = String::Split(selectedProject, '\\'); + auto fileName = backslashSplits[backslashSplits.size() - 1]; + std::string finalPath = selectedProject; + + bool endsWithExtension = String::EndsWith(fileName, ".project"); + if (!endsWithExtension) + { + // We need to createa folder + auto dirPath = selectedProject; + bool result = std::filesystem::create_directory(dirPath); + if (!result) + { + // Should we continue? + Logger::Log("Failed creating project directoy: " + dirPath); + } + + finalPath += "\\" + fileName + ".project"; + } if (selectedProject.empty()) { return; } - auto driveSplit = std::string(selectedProject.begin() + 3, selectedProject.end()); - auto pathSplit = String::Split(driveSplit, '/'); - auto projectFileName = pathSplit[pathSplit.size() - 1]; - - // We should create a folder now - // We substring minus 8 because we dont want the extension(.project) which is 8 chars. - const std::string directoryName = std::string(driveSplit.begin(), driveSplit.end()); - - const std::string finalProjectPath = - if(!endsWithExtension) - { - bool dirCreated = std::filesystem::create_directory(selectedProject); - if (!dirCreated) - { - Logger::Log("Failed to create project directory: " + selectedProject); - } - } - - - const std::string projectFilePath = selectedProject + "/" + projectFileName + ".project"; - Ref project = Project::New(projectFileName, "no description", projectFilePath); + auto project = Project::New(fileName, "no description", finalPath); Engine::LoadProject(project); Engine::LoadScene(Scene::New()); project->Save(); diff --git a/Nuake/src/Window.cpp b/Nuake/src/Window.cpp index 102b9d0c..c4c667e3 100644 --- a/Nuake/src/Window.cpp +++ b/Nuake/src/Window.cpp @@ -271,6 +271,13 @@ namespace Nuake { return; Vector2 size = m_Framebuffer->GetSize(); + + if (size.x < 1 || size.y < 1) + { + size.x = 1.0; + size.y = 1.0; + } + cam->AspectRatio = size.x / size.y; m_Scene->m_EditorCamera->OnWindowResize(size.x, size.y);