fn check_exist()

in build2cmake/src/fileset.rs [13:30]


    fn check_exist(&self, target_dir: &Path) -> Result<()> {
        let mut existing = Vec::new();
        for path in self.0.keys() {
            let full_path = target_dir.join(path);
            if full_path.exists() {
                existing.push(path.to_string_lossy().into_owned());
            }
        }

        if !existing.is_empty() {
            bail!(
                "File(s) already exists in target directory: {}\nUse `--force` to overwrite.",
                existing.join(", ")
            );
        }

        Ok(())
    }