From 65ab398355ed0d68d6c7fb82edaef6afcd00b591 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sun, 27 Jan 2019 03:31:37 +0400 Subject: Sun, 27 Jan 2019 03:31:37 +0400 Signed-off-by: Valentin Popov --- src/main.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 401bbe4..5b35f4a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ use std::fs::File; use std::io::BufReader; +use std::path::Path; extern crate clap; use clap::{load_yaml, App}; @@ -13,7 +14,11 @@ fn main() { let path = matches.value_of("FILE").unwrap(); - let file: File = File::open(path).unwrap(); - let data: ParserResult = parse(BufReader::new(file)); - dbg!(data.meeting_name); + match Path::new(path).exists() { + true => { + let file: File = File::open(path).unwrap(); + let data: ParserResult = parse(BufReader::new(file)); + } + _ => panic!("Error File!"), + }; } -- cgit v1.2.3