summaryrefslogtreecommitdiff
path: root/cli/repl.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/repl.rs')
-rw-r--r--cli/repl.rs18
1 files changed, 2 insertions, 16 deletions
diff --git a/cli/repl.rs b/cli/repl.rs
index 0cac6c4ea..7abb76708 100644
--- a/cli/repl.rs
+++ b/cli/repl.rs
@@ -2,6 +2,7 @@
use crate::deno_dir::DenoDir;
use deno::ErrBox;
use rustyline;
+use std::fs;
use std::path::PathBuf;
#[cfg(not(windows))]
@@ -76,14 +77,7 @@ impl Repl {
}
fn save_history(&mut self) -> Result<(), ErrBox> {
- if !self.history_dir_exists() {
- eprintln!(
- "Unable to save REPL history: {:?} directory does not exist",
- self.history_file
- );
- return Ok(());
- }
-
+ fs::create_dir_all(self.history_file.parent().unwrap())?;
self
.editor
.save_history(&self.history_file.to_str().unwrap())
@@ -94,14 +88,6 @@ impl Repl {
})
}
- fn history_dir_exists(&self) -> bool {
- self
- .history_file
- .parent()
- .map(|ref p| p.exists())
- .unwrap_or(false)
- }
-
pub fn readline(&mut self, prompt: &str) -> Result<String, ErrBox> {
self
.editor