diff --git a/src/config.rs b/src/config.rs index e4642c3..2215eb3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -17,10 +17,10 @@ pub struct Config { /// The display name of the repository. pub name: String, - /// File root + /// File roots /// - /// The file root where all albums are stored. - pub root: String, + /// The file roots where all albums are stored. + pub root: Vec, /// UUIDv4 /// @@ -85,7 +85,7 @@ impl From for Config { fn from(x: Hostinfo) -> Config { Config { name: x.name, - root: "".to_string(), + root: Vec::new(), uuid: x.uuid, icon: x.icon, htpasswd: None, diff --git a/src/hostinfo.rs b/src/hostinfo.rs index 6afa4ed..1c40524 100644 --- a/src/hostinfo.rs +++ b/src/hostinfo.rs @@ -81,7 +81,11 @@ impl Hostinfo { /// /// Generates a Hostinfo based on a [Config]. pub fn generate(cfg: Config) -> io::Result { - let albums = Hostinfo::read_albums(cfg.root.as_str())?; + let mut albums: Vec = Vec::new(); + for rootpath in &cfg.root { + let album_slice = Hostinfo::read_albums(rootpath)?; + albums.extend(album_slice); + } let mut hostinfo = Hostinfo::from(cfg); hostinfo.size = albums.iter().map(|x| x.size).sum(); hostinfo.albums = albums;