src/pathname.rs in faster_path-0.2.2 vs src/pathname.rs in faster_path-0.2.3

- old
+ new

@@ -1,8 +1,9 @@ use helpers::*; use basename; use chop_basename; +use cleanpath_aggressive; use dirname; use extname; use plus; use ruru; @@ -31,14 +32,14 @@ // pub fn pn_ascend(){} pub fn pn_basename(pth: MaybeString, ext: MaybeString) -> RString { RString::new( - &basename::basename( + basename::basename( pth.ok().unwrap_or(RString::new("")).to_str(), ext.ok().unwrap_or(RString::new("")).to_str() - )[..] + ) ) } pub fn pn_children(pth: MaybeString, with_dir: MaybeBoolean) -> Array { let rstring = pth.ok().unwrap_or(RString::new(".")); @@ -113,12 +114,18 @@ } } // pub fn pn_cleanpath(pth: MaybeString){} -// pub fn pn_cleanpath_aggressive(pth: MaybeString){} +pub fn pn_cleanpath_aggressive(pth: MaybeString) -> RString { + let path = cleanpath_aggressive::cleanpath_aggressive( + pth.ok().unwrap_or(RString::new("")).to_str() + ); + RString::new(&path) +} + // pub fn pn_cleanpath_conservative(pth: MaybeString){} // pub fn pn_del_trailing_separator(pth: MaybeString){} // pub fn pn_descend(){} @@ -131,13 +138,13 @@ ) } pub fn pn_dirname(pth: MaybeString) -> RString { RString::new( - &dirname::dirname( + dirname::dirname( pth.ok().unwrap_or(RString::new("")).to_str() - )[..] + ) ) } // pub fn pn_each_child(){} @@ -175,11 +182,11 @@ arr } pub fn pn_extname(pth: MaybeString) -> RString { RString::new( - &extname::extname(pth.ok().unwrap_or(RString::new("")).to_str())[..] + extname::extname(pth.ok().unwrap_or(RString::new("")).to_str()) ) } // pub fn pn_find(pth: MaybeString ,ignore_error: Boolean){} @@ -226,6 +233,5 @@ // pub fn pn_relative_path_from(){} // pub fn pn_rmtree(pth: MaybeString) -> NilClass { // NilClass::new() // } -