Skip to content

Commit

Permalink
move history to adana dir
Browse files Browse the repository at this point in the history
  • Loading branch information
nbittich committed Mar 20, 2024
1 parent 6cba1ae commit 3b2f093
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion adana-db/src/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl<K: Key + Clone, V: Value + Clone> DbOp<K, V> for InMemoryDb<K, V> {
.or_else(|| Some(self.default_tree.to_string()))
}

/// return true if the three has to be opened
/// return true if the tree has to be opened
fn open_tree(&mut self, tree_name: &str) -> Option<bool> {
if let Some(current_tree) = &self.current_tree {
if current_tree == tree_name {
Expand Down
13 changes: 9 additions & 4 deletions adana-shell/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ use rustyline::{
Cmd, CompletionType, Config, EditMode, Editor, KeyEvent, Movement,
};
use rustyline_derive::*;
use std::path::{Path, MAIN_SEPARATOR};
use std::path::{Path, PathBuf, MAIN_SEPARATOR};
use std::process::Command;

use adana_script_core::constants::PI;

const HISTORY_PATH: &str = "adana/history.txt";

fn get_default_history_path() -> Option<Box<Path>> {
let mut home_dir = dirs::home_dir()?;
home_dir.push(".adana.history.txt");
Some(home_dir.into_boxed_path())
let history_path =
dirs::data_dir().or_else(dirs::home_dir).map(|mut pb| {
pb.push(PathBuf::from(HISTORY_PATH));
pb
})?;
Some(history_path.into_boxed_path())
}

pub fn save_history(
Expand Down

0 comments on commit 3b2f093

Please sign in to comment.