/// Creates a new unloaded folder from a given path. If the path doesn't
/// exist or doesn't refer to a folder, we return `None`.
Creates a new unloaded folder from a given path. If the path doesn't
exist or doesn't refer to a folder, we return `None`.
Creates a new unloaded folder from a given path . If the path doesn ' t exist or doesn ' t refer to a folder we return ` None ` .
pub fn new_folder<U: AsRef<OsStr>>(path: &U) -> Option<Self> {
        let path = PathBuf::from(&path);
        if !(path.exists() && path.is_dir()) {
            return None;
        }
        // Takes the name from the folder itself.
        Some(Self::UnloadedFolder {
            name: String::from(path.file_name().map(OsStr::to_str).flatten().unwrap_or("")),
        })
    }
pub fn new_folder < U : AsRef < OsStr > > ( path : & U ) -> Option < Self > { let path = PathBuf :: from ( & path ) ; if ! ( path . exists ( ) && path . is_dir ( ) ) { return None ; } // Takes the name from the folder itself. Some ( Self :: UnloadedFolder { name : String :: from ( path . file_name ( ) . map ( OsStr :: to_str ) . flatten ( ) . unwrap_or ( " " ) ) , } ) }
Creates a new unloaded folder from a given path.
Creates a new unloaded folder from a given path .
path
&U