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

Prevent creating projects in folders that can "brick" the editor until moved #60332

Closed
lolbugsnstuff opened this issue Apr 17, 2022 · 6 comments · Fixed by #56420
Closed

Prevent creating projects in folders that can "brick" the editor until moved #60332

lolbugsnstuff opened this issue Apr 17, 2022 · 6 comments · Fixed by #56420

Comments

@lolbugsnstuff
Copy link

Godot version

3.3.4 flathub

System information

Chromebook 32bit ran on linux

Issue description

As soon as I open up Godot it has a tab (and this is the only tab) stating that Error: Can't run project: no main scene defined in the project.
It's just a white box that states that message and no matter what I do I cannot get past this stage, any help?

Steps to reproduce

To reproduce these circumstances you need to on a Chromebook open a new project once recently download it, leave it empty and leave (I was checking out the software and then left) after that this error message will pop up.

Minimal reproduction project

[https://docs.google.com/presentation/d/1LyO5Yk52BFnr1MXw4soUyyKtkWC20i3Dj7SF7u_hLps/edit#slide=id.p](url for the error message)

@KoBeWi
Copy link
Member

KoBeWi commented Apr 17, 2022

When you run Godot executable inside a project directory, it will run the project instead of opening the editor (unless you run with -e argument).

@Calinou
Copy link
Member

Calinou commented Apr 17, 2022

If this occurs when you start Godot from your desktop environment's launcher, this is probably because you created a project folder directly within your home directory (/home/<username>). Don't do this, as Godot will try to run the project in the default working directory for applications that are started.

You can fix this by creating a folder and moving your project files there (project.godot, and all your scenes and scripts).


To avoid this in the future, we should disallow creating projects directly within the home folder or in the same folder as the editor binary. For instance, if your Godot editor binary is installed in /home/username/bin/godot, the following locations would be disallowed in the project manager's Create New Project dialog:

  • /home/username/
  • /home/username/bin/

Creating projects in subfolders such as /home/username/mygame/ and /home/username/bin/mygame/ would still be allowed. The error message would be something like this:

Can't create project in reserved location. Create a subfolder with the project inside instead.

Opening existing projects in those locations would remain allowed though. This proposal only affects the project manager creation dialog, not anything else.

Alternatively, we can follow advice from #21306. All this will be resolved automatically as project folders would be created implicitly, rather than explicitly.

@lolbugsnstuff
Copy link
Author

Thanks, I've managed to open godot again.

@Calinou
Copy link
Member

Calinou commented Apr 18, 2022

Reopening, as we should still prevent creating projects in locations that can "brick" the editor.

@Calinou Calinou reopened this Apr 18, 2022
@Calinou Calinou changed the title I can't seem to open godot Prevent creating projects in folders that can "brick" the editor until moved Apr 18, 2022
@Calinou Calinou added this to the 4.0 milestone Jul 8, 2022
@nathanfranke
Copy link
Contributor

nathanfranke commented Jul 10, 2022

Hmm, I am definitely going to implement something to prevent users from creating a project as their home directory / executable directory. I vaguely remember importing my entire home directory with Godot Engine™, I forget if it broke my install 😆

However, I feel like this could be an engine bug. On linux, we can already pass --project-manager using a desktop file, to avoid this completely. What steps would need to be taken to automatically use this flag on Windows/Mac?

Edit: Question, how should I even get the home working directory through code? The closest thing I found is get_data_dir which is ~/.local/share on Linux.

Edit 2: Ah, I answered my own question. I can get the working directory using DirAccess::get_current_dir.

Edit from far in the future: Proposal for how to get home directory: godotengine/godot-proposals#4851

@Calinou
Copy link
Member

Calinou commented Mar 16, 2023

Fixed by #74964 (will be in 4.0.1).

@Calinou Calinou closed this as completed Mar 16, 2023
@Calinou Calinou modified the milestones: 4.x, 4.0 Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants