Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core/utils/fs: Check for doc presence when handling trash errors (#2120)
The error message thrown by Electron's `shell.trashItem()` method is localized on macOS. Therefore, we can't detect missing document error by matching the error message against a crafted RegExp as this would mean building a RegExp that matches against every possible language. e.g. when deleting missing `dir/file.txt`, the message would be: - in English, `The file « file.txt » doesn't exist` - in French, `Le fichier « file.txt » n'existe pas` The only way to be sure `shell.trashItem()` failed because the document does not exist anymore is to check whether the document exists or not (minus some potential race condition issues). This is slightly less efficient but works on all platforms for every language.
- Loading branch information