sindresorhus / trash

Move files and directories to the trash
MIT License
2.57k stars 78 forks source link

Error on Linux if user never deleted any files #116

Closed kimlimjustin closed 3 years ago

kimlimjustin commented 3 years ago

This package works fine for me at first, but when I tried to run it in a new system (Ubuntu in Virtualbox), I noticed that there's no Trash directory at .local/share if the user never deleted any files, which causing an error. I think this can be fixed if we add a piece of code to check if the dir exists or otherwise create it. Thanks!

sindresorhus commented 3 years ago

That should already be handled: https://github.com/sindresorhus/trash/blob/74bed3edf34826595cf4a990b01b2b9b10733238/lib/linux.js#L60-L61

Make sure you're on the latest version.


// @stroncium

kimlimjustin commented 3 years ago

Yes, it works on the latest version, thanks!