Skip to content

Commit

Permalink
Fix truncation of output dir name
Browse files Browse the repository at this point in the history
  • Loading branch information
andriygm committed Feb 20, 2025
1 parent 92ea700 commit ce4a66f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn get_output_name(out_dir: &Path) -> String {
Err(_) => out_dir.to_path_buf(),
};

path.file_stem()
path.file_name()
.unwrap_or("project".as_ref())
.to_string_lossy()
.to_string()
Expand Down Expand Up @@ -212,3 +212,14 @@ impl Project {
Ok(result)
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_get_output_name() {
let path = Path::new("/path/to/output.name");
assert_eq!(get_output_name(path), "output.name");
}
}

0 comments on commit ce4a66f

Please sign in to comment.