mono/monodevelop

Delete Command - should file move to trash

poolborges opened this issue · 0 comments

Problem

When delete a file or multiples a from project/solution using the ContextMenu option "Delete" those files will not goes to TRASH/RecycleBin.
I thing that the semantic of delete is correct, but on a computer when a user: Delete a file the expected behavior is "move to trash" like when he Delete a text on Text Editor the expected behavior is possible to "Undo"

TEST ON: Visual Studio for Mac (8.9 Preview Build 265) which is based on MonoDevelop.

Tracking where is problem in code

After search in repository with better keyword "Exclude From Project".

The method "DeleteMultipleItems" handler the "Delete" Command has the attribute [CommandHandler (EditCommands.Delete)].
Can found at
https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs

DeleteMultipleItems will invoke RemoveFilesFromProject wich invoke FileService.DeleteFile https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs

FilService will lookup for the "Correct "FileSystemExtension ("/MonoDevelop/Core/FileSystemExtensions"), which is
DummyFileSystemExtension if I'm correct which is part of "Core Addins". Core Addins "Extensions Model" https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Core/MonoDevelop.Core.addin.xml

Implmentations using System.IO.File.DeleteFile (permanent delete)

Possible Solution - 01

Improve message inside method ProjectFileNodeBuilder.DeleteMultipleItems alerting the user that file will be permanent delete (not moved to trash)

GettextCatalog.GetString ("Are you sure you want to delete the selected files and " +

Possible Solution - 02

Find a .NET library (if license allow) that provide a cross OS implementation of "move to trash".

  • Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile (but is i don't know if available on all OS)

Possible Solution - 03

Should be Implement this expect behavior "move to trash" on MonoDevelop, but I'm not ready to provide a possible "implementation", because I'm new with c# and MonoDevelop code base

Possible Solution - 04

:) Ask .NET Framework (Microsoft) to support this kind of operation System.IO.File

Trash API

Operative System (OS) References

Conclusion

Most o solutions/software relay on low level IO to delete and not move to trash, that is not what a user expect
Maybe this should be solved at .NET Framework/Mono level or extracted as external library

Others References