tsk-76: Cleanup
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
pub fn concatenate_path(directory: &str, filename: &str, last_index: usize) -> Result<String, std::io::Error> {
|
||||
pub fn concatenate_path(
|
||||
directory: &str,
|
||||
filename: &str,
|
||||
last_index: usize,
|
||||
) -> Result<String, std::io::Error> {
|
||||
if let Some(character) = directory.chars().nth(last_index) {
|
||||
let buffer: String = if character != '/' {
|
||||
format!("{directory}/")
|
||||
@@ -8,6 +12,8 @@ pub fn concatenate_path(directory: &str, filename: &str, last_index: usize) -> R
|
||||
|
||||
Ok(format!("{buffer}{filename}"))
|
||||
} else {
|
||||
Err(std::io::Error::other(crate::constants::error::LAST_CHARACTER_IN_DIRECTORY))
|
||||
Err(std::io::Error::other(
|
||||
crate::constants::error::LAST_CHARACTER_IN_DIRECTORY,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user