Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: danielpclark/faster_path
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 72879c9dbd4b154dfd01509297689d9aec0c8954
Choose a base ref
..
head repository: danielpclark/faster_path
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e4d021cee06585a9fdd8fb69999567b20af8a585
Choose a head ref
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/basename.rs
9 changes: 5 additions & 4 deletions src/basename.rs
Original file line number Diff line number Diff line change
@@ -77,11 +77,12 @@ pub extern fn basename(str_pth: *const c_char, comp_ext: *const c_char) -> *cons
_ => base,
}
} else {
extract_last_segment(if &string[string.len() - globish_string.len()..] == globish_string {
&string[0..string.len() - globish_string.len()]
let last_segment = extract_last_segment(string);
if &last_segment[last_segment.len() - globish_string.len()..] == globish_string {
&last_segment[0..last_segment.len() - globish_string.len()]
} else {
string
})
last_segment
}
};
CString::new(result).unwrap().into_raw()
}