···36363737 inquire::set_global_render_config(get_render_config());
38383939- // Run cargo info maudit in a tmp directory to avoid catching a local version
4039 let cargo_search = std::process::Command::new("cargo")
4140 .arg("search")
4241 .arg("maudit")
4342 .args(["--limit", "1"])
4343+ .current_dir(std::env::temp_dir()) // `cargo search` sometimes can fail in certain directories, so we use a temp dir
4444 .output()
4545 .expect("Failed to run cargo info maudit");
4646···8888 })
8989 .with_validators(&[
9090 Box::new(|s: &str| {
9191+ // Don't check if the directory already exists if the user wants to use the current directory
9292+ if s == "." {
9393+ return Ok(Validation::Valid);
9494+ }
9595+9196 if std::path::Path::new(&s).exists() {
9297 Ok(Validation::Invalid(
9398 "A directory with this name already exists".into(),
···221226 info!(name: "SKIP_FORMAT", "👑 {} {}! Next steps:", "Project created".bold(), "successfully".green().to_string().bold());
222227 println!();
223228224224- info!(name: "SKIP_FORMAT", "1. Run {} to enter your project's directory.", format!("cd {}", project_path.display()).bold().bright_blue().underline());
225225- info!(name: "SKIP_FORMAT", "2. Run {} to start the development server, {} to stop it.", "maudit dev".bold().bright_blue().underline(), "CTRL+C".bright_blue());
229229+ let enter_directory = if project_path != PathBuf::from(".") {
230230+ format!(
231231+ "1. Run {} to enter your project's directory.\n2. ",
232232+ format!("cd {}", project_path.display())
233233+ .bold()
234234+ .bright_blue()
235235+ .underline()
236236+ )
237237+ } else {
238238+ " ".to_string()
239239+ };
240240+241241+ info!(
242242+ name: "SKIP_FORMAT",
243243+ "{}Run {} to start the development server, {} to stop it.",
244244+ enter_directory,
245245+ "maudit dev".bold().bright_blue().underline(),
246246+ "CTRL+C".bright_blue()
247247+ );
226248 println!();
227249228250 info!(name: "SKIP_FORMAT", " Visit {} for more information on using Maudit.", "https://maudit.org/docs".bold().bright_magenta().underline());
···267289 Ok(content) => {
268290 let mut cargo_toml = content.parse::<DocumentMut>().expect("invalid doc");
269291292292+ let project_path = project_path
293293+ .canonicalize()
294294+ .expect("Failed to canonicalize project path");
270295 if let Some(project_name) = project_path.file_name().and_then(|name| name.to_str()) {
271296 cargo_toml["package"]["name"] = toml_edit::value(project_name);
272297···343368344369fn has_invalid_filepath_chars(s: &str) -> bool {
345370 s.chars().any(|c| {
346346- c == '/'
347347- || c == '\\'
371371+ c == '\\'
348372 || c == ':'
349373 || c == '*'
350374 || c == '?'