mecha10-templates 0.8.2

Mecha10 project templates — code generation, init, and template services
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Validation logic for project initialization
//!
//! Provides validation functions for project paths.

use anyhow::{anyhow, Result};
use std::path::Path;

/// Check if a directory already exists.
pub fn check_directory_not_exists(path: &Path) -> Result<()> {
    if path.exists() {
        return Err(anyhow!(
            "Directory '{}' already exists.\n\
             Please choose a different project name or remove the existing directory.",
            path.display()
        ));
    }
    Ok(())
}