Back out option open method and attempt create file on open file error

This commit is contained in:
Jon Moroney 2019-01-07 10:40:01 -08:00
parent 1b3da2af3f
commit d04ee52f1a

View file

@ -2,7 +2,7 @@ use std::io::{stdin};
use std::path::{Path};
use std::sync::mpsc::{Sender, channel};
use std::collections::hash_map::{HashMap, Entry};
use std::fs::{self, DirEntry, OpenOptions};
use std::fs::{self, DirEntry};
use std::io::prelude::*;
use clap::{Arg, App};
use rayon::prelude::*;
@ -199,7 +199,7 @@ fn process_full_output(shared_files: &Vec<&Fileinfo>, unique_files: &Vec<&Filein
match arguments.value_of("Output").unwrap_or("Results.txt"){
"no" => {},
destination_string => {
match OpenOptions::new().write(true).create(true).open(destination_string) {
match fs::File::open(destination_string) {
Ok(_f) => { //File exists.
println!("---");
println!("File {} already exists.", destination_string);