From 7c82aa6623fa9a70faf073605d3a211dc5666fbb Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 18 Jul 2017 13:39:31 +0100 Subject: [PATCH] Store input files as paths --- src/config/mod.rs | 5 +++-- src/config/read.rs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index 1a1973a..464c026 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -1,5 +1,6 @@ use serde_yaml; use serde_yaml::Value; +use std::path::PathBuf; pub mod read; pub mod validate; @@ -7,14 +8,14 @@ pub mod consts; #[derive(Debug, Serialize, Deserialize, Default)] pub struct Config { - input: Vec, + input: Vec, } impl Config { fn new(raw: Value) -> Config { return Config { - input: read::get_inputs(raw), + input: read::get_input_files(raw), ..Default::default() }; } diff --git a/src/config/read.rs b/src/config/read.rs index a84b459..510f0fc 100644 --- a/src/config/read.rs +++ b/src/config/read.rs @@ -22,7 +22,8 @@ pub fn read() -> String { } -pub fn get_inputs(conf: Value) -> Vec { +pub fn get_input_files(conf: Value) -> Vec { + let working_dir = current_dir().unwrap(); let input_values = conf.get("input").unwrap().as_sequence().unwrap().to_vec(); - return input_values.into_iter().map(|x| x.as_str().unwrap().to_string()).collect(); + return input_values.into_iter().map(|x| working_dir.join(x.as_str().unwrap().to_string())).collect(); }