Skip to content

Commit

Permalink
Don't use empty string for project name fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
andriygm committed Oct 7, 2024
1 parent 114744c commit 17618cf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ impl std::error::Error for GenerateError {
pub fn get_project_name(out_dir: &Path) -> String {
let path = match out_dir.canonicalize() {
Ok(path) => path,
Err(_) => return "".to_string(),
Err(_) => "project".into(),
};

return path
.file_stem()
path.file_stem()
.unwrap_or_default()
.to_string_lossy()
.into_owned();
.to_string()
}

/// Generates a filled directory from the specified spackle project.
Expand Down

0 comments on commit 17618cf

Please sign in to comment.