diff --git a/libimaginteraction/src/error.rs b/libimaginteraction/src/error.rs index 70f026f1..1a4be7df 100644 --- a/libimaginteraction/src/error.rs +++ b/libimaginteraction/src/error.rs @@ -28,6 +28,7 @@ generate_error_module!( ConfigMissingError => "Configuration missing", ConfigTypeError => "Config Type Error", NoConfigError => "No configuration", + ReadlineHistoryFileCreationError => "Could not create history file for readline", ReadlineError => "Readline error" ); ); diff --git a/libimaginteraction/src/readline.rs b/libimaginteraction/src/readline.rs index de2a1e95..7b998dd0 100644 --- a/libimaginteraction/src/readline.rs +++ b/libimaginteraction/src/readline.rs @@ -84,6 +84,12 @@ impl Readline { .build(); let mut editor = Editor::new(config); + + if !histfile.exists() { + let _ = try!(File::create(histfile.clone()) + .map_err_into(IEK::ReadlineHistoryFileCreationError)); + } + let _ = try!(editor.load_history(&histfile).map_err_into(ReadlineError)); Ok(Readline {