Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling Application start when previous opened project was deleted. Project Selection dialogue? #3

Closed
JamesTKhan opened this issue Feb 17, 2022 · 0 comments · Fixed by #206
Labels
enhancement New feature or request

Comments

@JamesTKhan
Copy link
Owner

When opening the application it attempts to load the previously loaded project in Editor.kt create()

// open last edited project or create default project
var context: ProjectContext? = projectManager.loadLastProject()
if (context == null) {
    context = createDefaultProject()
}

if(context == null) {
    throw GdxRuntimeException("Couldn't open a project")
}

However if the previously opened project was deleted (or the .pro was corrupted) then the fallback is to create a default project only if the registry is empty or last project is null

private fun createDefaultProject(): ProjectContext? {
    if (registry.lastOpenedProject == null || registry.projects.size == 0) {
        val name = "Default Project"
        var path = FileUtils.getUserDirectoryPath()
        path = FilenameUtils.concat(path, "MundusProjects")

        return projectManager.createProject(name, path)
    }

    return null
}

If the fallback occurs and the registry is not empty, a GdxRuntimeException is thrown. The solution may be to have a separate "Project Select" dialog in this situation to choose a project to open or create a new one. It would also be nice to have this dialogue for first time launching the application as well, instead of creating a default project.

@JamesTKhan JamesTKhan added the enhancement New feature or request label May 20, 2022
@JamesTKhan JamesTKhan linked a pull request Jul 29, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant