GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

Delete files not existent in project directory

Open DavidMLPalma opened this issue 10 months ago • 3 comments

Fix #4120 : When renaming scenes/extensions/external events/external layouts, duplicate files exist, one with the old name and one with the new name. Similarly, when deleting this items, the respective files are also not removed from the project directory. This is due to the fact that when saving the project, only the existing files in the project editor are written and saved, and nothing more is done. There may still remain old files that should not be there, potentially creating duplicates and confusion. Therefore, when saving, we can resolve this issue by deleting all files from the scenes/extensions/external events/external layouts directories, before writing the correct files.

DavidMLPalma avatar Apr 03 '24 20:04 DavidMLPalma

Hi @DavidMLPalma, Rhanks for the suggested PR!

I feel like this strategy is a bit brutal. We already have issues with users saving their projects in the installation directory and losing their projects because of that (when GDevelop is updated). So I think it's better not to have another potential cause for losing files.

May I suggest that you check if the directory name is in the list splittedProjectFolderNames in LocalProjectWriter?

AlexandreSi avatar Apr 23 '24 08:04 AlexandreSi

Hi @AlexandreSi , Thanks for your reply!

I totally get your point, and in fact by checking if the directory name is one of those present in the list may lead to a more secure solution. I will change it then.

DavidMLPalma avatar Apr 23 '24 22:04 DavidMLPalma

Hi @AlexandreSi , Thanks a lot for the patience and feedback! I will try to implement all the things you pointed out !

DavidMLPalma avatar May 06 '24 21:05 DavidMLPalma

Hi @AlexandreSi ,

Once again, thanks for your help and consideration !

DavidMLPalma avatar May 21 '24 21:05 DavidMLPalma