# fs: Return trashed file location \(\#52012\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/b6562e8afadaeb73828dfd7dfa94fe8cf8876e18)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: b6562e8afadaeb73828dfd7dfa94fe8cf8876e18

Requested commit: b6562e8afadaeb73828dfd7dfa94fe8cf8876e18

Commit: b6562e8afadaeb73828dfd7dfa94fe8cf8876e18

Tree: c842aaee8e24febf702897a3d49330a810f283da

Author: Dino

Committer: GitHub

## Message

```
fs: Return trashed file location (#52012)

Update both `Fs::trash_dir` and `Fs::trash_file` to now return the
location of the trashed directory or file, as well as adding the
`trash-rs` create dependency and updating the `RealFs` implementation
for these methods to simply leverage `trash::delete_with_info`.

* Add `fs::Fs::TrashedEntry` struct, which allows us to track the
  original file path and the new path in the OS' trash
* Update the `fs::Fs::trash_dir` and `fs::Fs::trash_file` signatures to
  now return `Result<TrashedEntry>` instead of `Result<()>`
* The `options` argument was removed because it was never used by
  implementations other than the default one, and with this change to
  the signature type, we no longer have a default implementation, so the
  `options` argument would no longer make sense
* Update `fs::RealFs::trash_dir` and `fs::RealFs::trash_file`
  implementations to simply delegate to `trash-rs` and convert the
  result to a `TrashedEntry`
* Add `fs::FakeFs::trash` so we can simulate the OS' trash during tests
  that touch the filesystem
* Add `fs::FakeFs::trash_file` implementation to leverage
  `fs::FakeFs::trash`
* Add `fs::FakeFs::trash_dir` implementation to leverage
  `fs::FakeFs::trash`
```

## Parents

- [6184b2457c796efe19d4df2dc7286310db7797f3](https://git.cafe/gitcafe/zed/commit/6184b2457c796efe19d4df2dc7286310db7797f3?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/b6562e8afadaeb73828dfd7dfa94fe8cf8876e18?format=markdown)
