cargo_attribution/lib.rs
1// SPDX-License-Identifier: MPL-2.0
2// This Source Code Form is subject to the terms of the Mozilla Public
3// License, v. 2.0. If a copy of the MPL was not distributed with this
4// file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
6use color_eyre::Result;
7use std::{fs, path::Path};
8
9pub mod licenses;
10pub mod metadata;
11pub mod serialize;
12
13pub fn recreate_folder(path: &Path) -> Result<()> {
14 if path.try_exists()? {
15 fs::remove_dir_all(path)?;
16 }
17
18 fs::create_dir(path)?;
19
20 Ok(())
21}
22
23pub fn create_folder(path: &Path) -> Result<()> {
24 if path.try_exists()? {
25 return Ok(());
26 }
27
28 fs::create_dir(path)?;
29 Ok(())
30}