1#![allow(clippy::useless_format)]
2
3mod commands {
4 pub mod init;
5 pub mod package;
6}
7pub(crate) mod console {
8 mod command;
9 pub mod config;
10 pub mod error;
11 pub mod messages;
12 pub mod spinners;
13 pub mod step;
14 pub mod theme;
15
16 pub use command::*;
17 pub use config::*;
18 pub use error::*;
19 pub use messages::*;
20 pub use spinners::*;
21 pub use step::*;
22 pub use theme::*;
23}
24
25mod bindings;
26mod lib_type;
27mod metadata;
28mod path;
29mod swiftpackage;
30mod targets;
31mod templating;
32mod xcframework;
33
34pub use crate::console::error::Result;
35pub use crate::console::Config;
36pub use commands::*;
37pub use lib_type::LibType;
38pub use targets::*;
39
40use std::fs::{create_dir, remove_dir_all};
41use std::io;
42use std::path::Path;
43
44fn recreate_dir<P>(dir: P) -> crate::Result<()>
45where
46 P: AsRef<Path>,
47{
48 match remove_dir_all(&dir) {
49 Err(e) if e.kind() != io::ErrorKind::NotFound => Err(e.into()),
50 _ => create_dir(&dir).map_err(|e| e.into()),
51 }
52}