1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use std::path::{Path, PathBuf};
use fast_walker::{WalkItem, WalkPlan};
use gen_iter::GenIter;
use crate::{UnityError, UnityResult};
use fast_walker::utils::to_unix_path;
pub mod meta_file;
use std::fmt::{Debug, Formatter};

pub struct UnityProject {
    root: PathBuf,
}

mod clean;

impl UnityProject {
    pub fn new<P: AsRef<Path>>(root: P) -> UnityResult<Self> {
        let out = Self {
            root: root.as_ref().to_path_buf(),
        };
        let assets = out.assets_path();
        if !assets.exists() || !assets.is_dir() {
            Err(UnityError::custom_error("Assets folder not found"))?
        }
        Ok(out)
    }
    pub fn assets_path(&self) -> PathBuf {
        self.root.join("Assets")
    }
}