~sjm/sri

98ed0bd436d8fa84f1c01c085aaec66b0f99abaa — Sam Marshall 7 months ago 93c55c4
fetch_from_srifile -> fetch_from_dotfile is less confusing
3 files changed, 3 insertions(+), 3 deletions(-)

M src/filesystem.rs
M src/main.rs
M src/sri_file/sri_files.rs
M src/filesystem.rs => src/filesystem.rs +1 -1
@@ 27,7 27,7 @@ pub enum FilesystemError {
}

pub trait Filesystem {
    fn fetch_from_srifile(current_dir: &PathBuf) -> Result<Vec<SriFile>, FilesystemError>;
    fn fetch_from_dotfile(current_dir: &PathBuf) -> Result<Vec<SriFile>, FilesystemError>;
    fn fetch_from_dir(current_dir: &PathBuf) -> io::Result<Vec<SriFile>>;
    fn put(self, current_dir: &PathBuf) -> io::Result<()>;
}

M src/main.rs => src/main.rs +1 -1
@@ 17,7 17,7 @@ struct SriSerialised {
fn main() -> io::Result<()> {
    let current_dir = env::current_dir()?;

    let files: SriFiles = match SriFiles::fetch_from_srifile(&current_dir) {
    let files: SriFiles = match SriFiles::fetch_from_dotfile(&current_dir) {
        Ok(f) => Ok(SriFiles::new(f)),
        Err(FilesystemError::NoFile) => SriFiles::fetch_from_dir(&current_dir).map(|f| SriFiles::new(f)),
        Err(FilesystemError::NoFolder) => {

M src/sri_file/sri_files.rs => src/sri_file/sri_files.rs +1 -1
@@ 72,7 72,7 @@ impl SriFiles {
}

impl Filesystem for SriFiles {
    fn fetch_from_srifile(current_dir: &PathBuf) -> Result<Vec<SriFile>, FilesystemError> {
    fn fetch_from_dotfile(current_dir: &PathBuf) -> Result<Vec<SriFile>, FilesystemError> {
        let path = sri_dir(current_dir).unwrap();

        if !path.is_dir() {