sindresorhus / trash

Move files and directories to the trash
MIT License
2.58k stars 79 forks source link

Broken symlinks are silently ignored #63

Closed jdanford closed 6 years ago

jdanford commented 7 years ago

As the title says, the trash function silently ignores broken symlinks (because fs.existsSync returns false), whereas https://github.com/sindresorhus/macos-trash handles them as expected, i.e. moving them to the Trash. Is the former behavior intentional?

sindresorhus commented 7 years ago

I don't remember exactly why we're doing it in the first place, but I think it's so not to error on non-existing paths. Relevant commit: https://github.com/sindresorhus/trash/commit/34e4d71f7779f2b5406eb3e0b20cd5ea5ebed149

I guess we could use fs.lstatSync() instead to support broken symlinks.

jdanford commented 7 years ago

That's what I was thinking – should I go ahead and submit a PR?

sindresorhus commented 7 years ago

Yes :)