From 68c6c35f54c7ce4e7fb96bd014968057fdc132f3 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 20 Nov 2015 15:34:40 +0100 Subject: [PATCH] Add getFileList(self) to list files from basepath --- src/storage/backend.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/storage/backend.rs b/src/storage/backend.rs index 4b53f3fc..20336b9f 100644 --- a/src/storage/backend.rs +++ b/src/storage/backend.rs @@ -2,6 +2,9 @@ use std::error::Error; use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Result as FMTResult; +use std::path::Path; + +use glob::glob; use super::file::FileID; use super::file::File; @@ -23,7 +26,9 @@ impl<'a> StorageBackend<'a> { } } - fn getFileList() -> Vec<(String, FileID)> { + fn getFileList(&self) -> Option> { + let files: Vec<&Path> = glob(&self.basepath[..]); + files.map(|path| (path, file_id_from_path(path))).unwrap_or(None) } fn createEmpty() -> FileID {