+// get the history file name as string - home dir + .evpfhistory
+fn get_history_file () -> Result<String,String> {
+ // get the environment variable HOME
+ let home_path = env::var ("HOME");
+ // if not found, return an error
+ if home_path.is_err () {
+ return Err (HOMEDIR_NOT_FOUND.to_string());
+ }
+ // build the path for the history file i.e. homedir + .evpfhistory in
+ // platform independent way
+ let mut hist_file = PathBuf::new ();
+ hist_file.push (home_path.unwrap());
+ hist_file.push (".evpfhistory");
+
+ // if cannot convert to string return error
+ if hist_file.to_str ().is_none () {
+ return Err (HOMEDIR_NOT_FOUND.to_string());
+ }
+
+ // return the history file path as a string
+ let hist_file_path = String::from (hist_file.to_str().unwrap());
+ return Ok (hist_file_path);
+}
+