Skip to content

Commit

Permalink
version0.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
skillzaa committed Dec 14, 2021
1 parent 3d5e7cb commit f7c9f05
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "brown"
version = "0.1.7"
version = "0.1.8"
edition = "2021"
authors = ["bilal <[email protected]>"]
description = "A simple library that makes dealing with Rust file system a breeze"
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@


>**Brown** library exports helpful functions which gives you a very simple API for creating managin and manipulating files,folder etc in the current working folder.
- The *tasks* feature is experimental.
- The API is almost final. I do not see any major changes in it.
- More tests will be added and code will be improved; other than that the lib is complete.
- *Keep in mind that thorugh out this library you do not need to add "./", it is added automatically.*
- *Please wait till version 1.0 for use in production*

- The word folder" and "directory" are used interchangebaly;there is no difference between a "folder" and "directory" in the documentation. They are both same.*


---
## Example
Expand Down Expand Up @@ -53,9 +54,7 @@ pub fn main(){

```

*Please note that there is no difference between a "folder" and "directory" in the documentation. The are both same.*
*Do not add the ./ anywhere in the paths, this will be added automatically. There are no relative paths used.*


Incase you have any issues with the library, let me know here [https://github.com/skillzaa/brown/issues](https://github.com/skillzaa/brown/issues)

**Please be in touch**
Expand Down
20 changes: 7 additions & 13 deletions src/bro/remove_dir_brute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::util;
/// assert!(outcome.is_ok());
/// ```
pub fn remove_dir_brute(dir_name:&str)->Result<bool,BrownError> {
util::sanitize_dir_path(&dir_name.to_string())?;
util::sanitize_dir_path(&dir_name.to_string())?;
let complete = String::from("./") + &dir_name;
let path = Path::new(&complete);
match fs::remove_dir_all(path) {
Expand All @@ -37,32 +37,26 @@ fn basic(){
}
#[test]
fn second(){
let folders =
create_dir_all("somefolder/sub");
assert!(folders.is_ok());
let p = "somefolder/sub";
let created =
create_file_brute("somefolder/sub/file.md");
create_dir_brute(p);
assert!(created.is_ok());
let deleted =
remove_file("somefolder/sub/file.md");
remove_dir_brute(p);
assert!(deleted.is_ok());
let cleanup =
remove_dir_brute("somefolder");
assert!(cleanup.is_ok());

}
#[test]
fn url_non_safe_chars_used(){
let pth = "ab?c.md";
let r = remove_file(pth);
let r = remove_dir_brute(pth);
let rr = r.unwrap_err();
assert_eq!(rr,BrownError::NonUrlSafeSymbolFound);
}
#[test]
fn err_begin_with_alphanumeric(){
let pth = "./abc.md";
let pth = "./abc";
let r =
remove_file(pth);
remove_dir_brute(pth);
let rr = r.unwrap_err();
assert_eq!(rr,BrownError::PathBeginWithAlphabet);
}
Expand Down
2 changes: 1 addition & 1 deletion target/.rustc_info.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"rustc_fingerprint":16323913331255626692,"outputs":{"15537503139010883884":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n","stderr":""},"931469667778813386":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/bilal/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"17598535894874457435":{"success":true,"status":"","code":0,"stdout":"rustc 1.57.0 (f1edd0429 2021-11-29)\nbinary: rustc\ncommit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c\ncommit-date: 2021-11-29\nhost: x86_64-unknown-linux-gnu\nrelease: 1.57.0\nLLVM version: 13.0.0\n","stderr":""},"2797684049618456168":{"success":false,"status":"exit status: 1","code":1,"stdout":"","stderr":"error: `-Csplit-debuginfo` is unstable on this platform\n\n"}},"successes":{}}
{"rustc_fingerprint":16323913331255626692,"outputs":{"2797684049618456168":{"success":false,"status":"exit status: 1","code":1,"stdout":"","stderr":"error: `-Csplit-debuginfo` is unstable on this platform\n\n"},"17598535894874457435":{"success":true,"status":"","code":0,"stdout":"rustc 1.57.0 (f1edd0429 2021-11-29)\nbinary: rustc\ncommit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c\ncommit-date: 2021-11-29\nhost: x86_64-unknown-linux-gnu\nrelease: 1.57.0\nLLVM version: 13.0.0\n","stderr":""},"931469667778813386":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/bilal/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"15537503139010883884":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n","stderr":""}},"successes":{}}

0 comments on commit f7c9f05

Please sign in to comment.