diff --git a/Cargo.lock b/Cargo.lock index cf07555..fa695b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "brown" -version = "0.1.7" +version = "0.1.8" dependencies = [ "qndr", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index 2ad9ef8..3fc0fec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "brown" -version = "0.1.7" +version = "0.1.8" edition = "2021" authors = ["bilal "] description = "A simple library that makes dealing with Rust file system a breeze" diff --git a/README.md b/README.md index 91a0fad..4696a39 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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** diff --git a/src/bro/remove_dir_brute.rs b/src/bro/remove_dir_brute.rs index af8032d..1a67b4b 100644 --- a/src/bro/remove_dir_brute.rs +++ b/src/bro/remove_dir_brute.rs @@ -11,7 +11,7 @@ use crate::util; /// assert!(outcome.is_ok()); /// ``` pub fn remove_dir_brute(dir_name:&str)->Result { - 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) { @@ -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); } diff --git a/target/.rustc_info.json b/target/.rustc_info.json index bec2650..5bf9d84 100644 --- a/target/.rustc_info.json +++ b/target/.rustc_info.json @@ -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":{}} \ No newline at end of file +{"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":{}} \ No newline at end of file