Removing large directories takes a while. We could try to move first a directory to the tempory directory and then delete it.
Yes, I can confirm that it is slow. With the default option, moveToTrash: true, it is also quite unreliable, sometimes failing completely with no error. If I run win-trash.exe (which is the native ultimately being called) from the command line then it fails to move anything to the trash and does not give an error message back. If moveToTrash option is true (which then uses fs.remove), it is marginally slower (about 15% slower) but is a lot more reliable. In the situation where trash would just fail, fs.remove removes everything but the top level directory (which is locked by the Theia application and presumably what was causing win-trash.exe to fail). However when I close the Theia application the lock on the directory is removed and the directory is then deleted, so works as well as can be expected.
Would you expect the 'move' strategy to replace the 'move to trash' option, or to replace the fs.remove option, or to be a third option? Note that on Windows a lock on the top level directory will often prevent the directory from being moved. So I would think the best strategy would be to first attempt to move the directory and if that fails then use fs.remove. Leave the 'move to trash' option the same (not a use case for us and it seems to have been there since the early days of fs2).
Another option would be to filter the directory out of all views. That would be a more complex solution.
Would you expect the 'move' strategy to replace the 'move to trash' option, or to replace the fs.remove option, or to be a third option?
I did not mean to change any APIs, only to improve implementation. If it is possible.
@westbury is this issue closable by #4572?
Yes, #4572 is the fix for this issue, so closing this. issue.
Most helpful comment
Yes, #4572 is the fix for this issue, so closing this. issue.