use std::path::{Path};
fn remove_trailing_separator(path: &str) -> String {
let path = Path::new(path);
let cleaned_path = path.components().as_path();
cleaned_path.to_string_lossy().into_owned()
}
fn main() {
let path_with_trailing_separator = "/path/project/";
let cleaned_path = remove_trailing_separator(path_with_trailing_separator);
println!("{}", cleaned_path);
}
/*
run:
/path/project
*/