-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve readme. Add remove_all function to mac as unimplemented.
- Loading branch information
1 parent
a651d0f
commit 2850270
Showing
4 changed files
with
38 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,32 @@ | ||
|
||
[![Crates.io](https://img.shields.io/crates/v/trash.svg)](https://crates.io/crates/trash) | ||
|
||
## About | ||
|
||
Trash is a Rust library that provides functionality to move files to the operating system's Recycle Bin. | ||
Trash is a Rust library that provides functionality to move files and folders to the operating system's Recycle Bin (or Trash or Rubbish Bin or what have you). | ||
|
||
The library currently supports Windows and Linux. Contribution to MacOS support would be very much appretiated. | ||
|
||
## Usage | ||
|
||
```rust | ||
extern crate trash; | ||
use std::fs::File; | ||
|
||
fn main() { | ||
// Let's create and remove a single file | ||
File::create("remove-me").unwrap(); | ||
trash::remove("remove-me").unwrap(); | ||
assert!(File::open("remove-me").is_err()); | ||
|
||
Note that this libaray is in early development. It is planned to be multi-platform but I only have a Windows and a Linux system, so creating a pull request with MacOS support would be very much appretiated. | ||
// Now let's remove multiple files at once | ||
let the_others = ["remove-me-too", "dont-forget-about-me-either"]; | ||
for name in the_others.iter() { | ||
File::create(name).unwrap(); | ||
} | ||
trash::remove_all(&the_others).unwrap(); | ||
for name in the_others.iter() { | ||
assert!(File::open(name).is_err()); | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters