godot icon indicating copy to clipboard operation
godot copied to clipboard

Option to delete project contents when removing from Project Manager is too dangerous

Open Mochafe opened this issue 1 year ago • 8 comments

Godot version

4

System information

Windows 10

Issue description

I created a project to try the new version of Godot but I couldn't run it for more than 15 seconds.

Godot crashed after a short time so I wanted to delete the project in order to create another one and that's when the magic happened, it deleted not only the Godot project folder but also the folder before it i.e. my user folder ("C:\Users\{user}\document") and of course nothing that was deleted was found in the recycle bin.

Steps to reproduce

Create and delete a project via the launcher

Minimal reproduction project

empty

Mochafe avatar Mar 09 '23 19:03 Mochafe

This was reported but not reproduced so should be reopened

Duplicate of #71053

AThousandShips avatar Mar 09 '23 19:03 AThousandShips

This was reported but not reproduced so should be reopened

Duplicate of #71053

I think it is fine to keep this one open and leave that one closed

clayjohn avatar Mar 09 '23 19:03 clayjohn

True, as long as it's linked here the comments there are accessible

AThousandShips avatar Mar 09 '23 20:03 AThousandShips

I would remove the option to delete the project contents, and let users do it from their filesystem.

Most likely what happened here, and what happened in #71053, is that the users thought they were creating a subfolder for their project, but instead they create a project in the parent folder that ended up being deleted.

This happens more often that not and is due to bad UX from our project creation dialog: image

This is the default state when you create a project.

There's a warning that the project path is not empty, but it's easy to miss. If I click "Create & Edit" here, I might expect it to create the "New Game Project" folder, but no, it will create a project.godot file in /home/akien, and start importing my whole $HOME. This in itself could cause a crash as experienced by @Mochafe if there's a lot of content to import and it runs out of memory or something.

This bad UX should also be fixed, but until it is, having a destructive option to cleanup such easy mistake is way too dangerous.

akien-mga avatar Mar 09 '23 20:03 akien-mga

There's a warning that the project path is not empty, but it's easy to miss. If I click "Create & Edit" here, I might expect it to create the "New Game Project" folder, but no, it will create a project.godot file in /home/akien, and start importing my whole $HOME.

I think it is better to prohibit creating projects in non-empty directories. Then, in theory, we will avoid the situation with creating a project in a folder with important data. This should solve both problems: 1. cluttering up .import files when creating a project in the wrong place, 2. deleting user data when deleting the "project" from the Project Manager.

dalexeev avatar Mar 10 '23 09:03 dalexeev

I tend to agree. This used to be the behavior but it was changed in #42526 (CC @aaronfranke). I think the problems caused by this feature are more significant than the use case of wanting to initialize a project in a non empty folder. For this use case, we can document how to create a project manually (basically creating an empty project.godot file).

akien-mga avatar Mar 10 '23 09:03 akien-mga

Wow, I didn't notice that this behavior changed several times. But perhaps the use case described in godotengine/godot-proposals#1811 is too rare to maintain it at this cost:

The specific use case here is that if you create an empty repository on GitHub, then clone to your computer, the cloned repo contains a .git folder, so you can't create a project there, and have to perform the workaround at the bottom of this proposal.

You can first create an empty project and repository locally and then push it.

dalexeev avatar Mar 10 '23 10:03 dalexeev

As a UX improvement, we could make the project manager automatically fill out the Project Path field as users type in the Project Name field.

We'd have to define conventions for converting characters that might be valid for project names but not for directory names, which might open another can of worms...

and-rad avatar Mar 10 '23 10:03 and-rad

As a UX improvement, we could make the project manager automatically fill out the Project Path field as users type in the Project Name field.

We'd have to define conventions for converting characters that might be valid for project names but not for directory names, which might open another can of worms...

I've been working on this here: https://github.com/godotengine/godot/pull/56420

nathanfranke avatar Mar 10 '23 21:03 nathanfranke

I was about to mention #74874 too because I just saw the thread on Reddit. I think a fix for this and @nathanfranke's PR would go well together, as they both help to mitigate this particular problem. Can someone take a look at it and see if it can be merged? We could then implement the changes discussed here on top of that.

and-rad avatar Mar 13 '23 21:03 and-rad

I agree with the above comments - @nathanfranke's solution makes the most sense to me. Instead of a button to create a new folder, creating a new folder should be the default operation, so that you don't accidentally mess up. It should be a toggle button like in https://github.com/godotengine/godot/pull/56420.

There is no reason that creating a folder should be a manual extra step the user has to do. 99% of the time you want to create a subfolder for the project. Using an existing folder is for edge cases only.

aaronfranke avatar Mar 14 '23 13:03 aaronfranke

I want to second this by saying I just now accidentally wiped my documents folder and as the project file deletion does not put it in the bin my files are now unrecoverable. Now for me this is not as big of a deal. Lost some stuff, but not anything too important.

But this is a security and UX risk as it is extremely easy to butter finger into deleting major parts of ones non-Godot related files.

Saltlight-Studio avatar Mar 15 '23 14:03 Saltlight-Studio

There is no reason that creating a folder should be a manual extra step the user has to do. 99% of the time you want to create a subfolder for the project. Using an existing folder is for edge cases only.

Someone just ended up creating a project in their Documents folder due to this. So yeah, let's create a folder by default.

Zireael07 avatar Mar 15 '23 16:03 Zireael07

The specific use case here is that if you create an empty repository on GitHub, then clone to your computer, the cloned repo contains a .git folder, so you can't create a project there, and have to perform the workaround at the bottom of this proposal.

Instead of allowing to create project in empty folders, the project manager could just ignore hidden files. So folders with only hidden files would be considered empty.

KoBeWi avatar Mar 17 '23 14:03 KoBeWi

When creating a new project, there is a yellow warning and a confirmation popup.

When downloading a project from the asset library, the confirmation popup is not present. Clicking the "Install & Edit" button just instantly opens the project.

This is a huge issue, and is probably the cause of this user's problem. The warning dialogue meant to prevent users from making mistakes is just completely missing when downloading projects from the asset library.

Screenshot 2023-03-17 at 11 20 18 AM

aaronfranke avatar Mar 17 '23 16:03 aaronfranke

Instead of allowing to create project in empty folders, the project manager could just ignore hidden files.

This again would hide information from and makes assumptions for the user. That's never a good idea in UX design.

IMO being more verbose and explicit is the way to go here.

rm-code avatar Mar 17 '23 17:03 rm-code

IMO being more verbose and explicit is the way to go here.

And also, if creating was only allowed in empty folders, the rules would be simple and predictable and easy to follow. No exceptions, no edge cases. Wanna create a project? Only in an empty folder. I think people are capable of adjusting their workflows accordingly.

and-rad avatar Mar 17 '23 18:03 and-rad

I didn't mean completely ignored. We could have a warning that the project has some hidden files, just like we had warning about non-empty folder. Allowing this would cover both issues - you could create projects in folders with .git, but not in your documents etc.

KoBeWi avatar Mar 17 '23 18:03 KoBeWi

@KoBeWi What about the README.md file? It might make sense to disallow creating in any folder that already has non-hidden folders in it, but for files and hidden folders, allow it with the warning popup.

aaronfranke avatar Mar 17 '23 18:03 aaronfranke

That makes sense too I guess.

KoBeWi avatar Mar 17 '23 19:03 KoBeWi

But is it worth it? Look at the exceptions you're coming up with. Why is a file in the directory okay but a folder is not? What if someone has a bunch of important files but no folders in a directory? They're going to end up here again. I really think this rule needs to be clearer and simpler. This issue is about weighing convenience for experienced users against catastrophe for beginners. Maybe err on the side of those that have more to lose?

and-rad avatar Mar 17 '23 21:03 and-rad

Well in any case, the current solution is #56420, which will make the folder created by default. So you will only risk if you disable a checkbox for creating the folder.

KoBeWi avatar Mar 17 '23 22:03 KoBeWi

Hi that was my proposal BTW:) https://github.com/godotengine/godot-proposals/issues/2421

And I love that feature.

I think the Create project dialog should create new folder automatically, I always create it. Isn't the project content removed to the trash tho? Also there could be some extra checks before removing the content, for example searching for other project.godot files in that directory

me2beats avatar May 06 '23 14:05 me2beats

So can we reach a consensus in time for 4.1 on how to handle this? I think #56420 is great and should definitely be merged, but what about the rest?

Should it ever be allowed to create a project in a folder that is not empty? I don't think it should, as the convenience of doing so doesn't outweigh the possible downside of people accidentally deleting important files.

Should the ability to delete files when removing projects be brought back? I don't have too much of an opinion, but from years of using Unreal Engine I can't say I ever missed that feature (Unreal doesn't allow deleting project files from the launcher either. In fact, it doesn't even have an option for removing projects from the launcher at all).

and-rad avatar May 11 '23 14:05 and-rad

Should it ever be allowed to create a project in a folder that is not empty? I don't think it should, as the convenience of doing so doesn't outweigh the possible downside of people accidentally deleting important files.

If you initialize version control metadata manually before creating a project, you need to be able to create a project in a folder with existing files.

Should the ability to delete files when removing projects be brought back? I don't have too much of an opinion, but from years of using Unreal Engine I can't say I ever missed that feature (Unreal doesn't allow deleting project files from the launcher either. In fact, it doesn't even have an option for removing projects from the launcher at all).

I don't think it's that important to have in the editor. File managers exist on every platform the Godot editor supports, and in HTML5, you can remove per-site data using the browser settings.

Calinou avatar May 11 '23 15:05 Calinou

If you initialize version control metadata manually before creating a project, you need to be able to create a project in a folder with existing files.

That is true. There are also other very valid use cases that require creating a new project in a non-empty directory. The question is are these use cases more important than people losing their stuff because they failed to pay attention just once? And my stance so far is that they are not. You can just as easily initialize the git repo after creating the project.

I'm aware that this creates inconvenience to people who are used to a certain workflow. No doubt about it. But as I wrote earlier, I think disaster prevention trumps convenience.

and-rad avatar May 11 '23 15:05 and-rad