Skip to main content

luaur_cli_lib/functions/
join_paths_file_utils.rs

1pub fn join_paths_basic_string_ch_ch_ch(str: &mut alloc::string::String, lhs: &str, rhs: &str) {
2    *str = lhs.to_string();
3    if !str.is_empty()
4        && str.as_bytes().last() != Some(&b'/')
5        && str.as_bytes().last() != Some(&b'\\')
6        && !rhs.is_empty()
7        && rhs.as_bytes().first() != Some(&b'/')
8        && rhs.as_bytes().first() != Some(&b'\\')
9    {
10        str.push('/');
11    }
12    str.push_str(rhs);
13}