A simple try in main

This commit is contained in:
Raamakrishnan 2020-01-25 13:37:20 +05:30
parent 17c4de3e5f
commit 3b6cb44627
2 changed files with 8 additions and 26 deletions

View file

@ -1,4 +1,7 @@
sample/file1.sv sample/file1.sv
sample/file2.sv sample/file2.sv
sample/file3.sv sample/file3.sv
sample/file4.sv sample/file4.sv
+incdir+sample/
// Some comment
+define+a=b+c=d+e=f

View file

@ -1,33 +1,12 @@
use std::env; use std::env;
use std::path::PathBuf; use std::path::PathBuf;
use std::fs; use std::fs;
use sv_filelist_parser;
fn main() { fn main() {
let args: Vec<String> = env::args().collect(); let args: Vec<String> = env::args().collect();
// get .f file let filelist = sv_filelist_parser::parse(&args[1])
let dot_f_file = PathBuf::from(&args[1]); .expect("Error parsing");
println!("pathbuf {:?}", dot_f_file); println!("{:#?}", filelist);
// check if .f file exists
if dot_f_file.is_file() {
println!("File exists", )
} else {
println!("File does not exist", )
}
// read .f file
let contents = fs::read_to_string(&dot_f_file)
.expect("Error while reading file");
println!("contents:\n{}", contents);
// check if all the files exist
for line in contents.lines() {
if PathBuf::from(line).is_file() {
println!("{} exists", line)
}
else {
println!("{} does not exist", line)
}
}
} }