fix(strider): update host mount-point

This commit is contained in:
Brooks J Rady 2021-09-19 16:38:36 +01:00
parent 1a1c10a226
commit c29b8e98bf

View file

@ -2,9 +2,11 @@ mod state;
use colored::*; use colored::*;
use state::{FsEntry, State}; use state::{FsEntry, State};
use std::{cmp::min, fs::read_dir}; use std::{cmp::min, fs::read_dir, path::Path};
use zellij_tile::prelude::*; use zellij_tile::prelude::*;
const ROOT: &str = "/host";
register_plugin!(State); register_plugin!(State);
impl ZellijPlugin for State { impl ZellijPlugin for State {
@ -29,7 +31,7 @@ impl ZellijPlugin for State {
self.path = p; self.path = p;
refresh_directory(self); refresh_directory(self);
} }
FsEntry::File(p, _) => open_file(&p), FsEntry::File(p, _) => open_file(p.strip_prefix(ROOT).unwrap()),
} }
} }
Key::Left | Key::Char('h') => { Key::Left | Key::Char('h') => {
@ -76,7 +78,7 @@ impl ZellijPlugin for State {
} }
fn refresh_directory(state: &mut State) { fn refresh_directory(state: &mut State) {
state.files = read_dir(&state.path) state.files = read_dir(Path::new(ROOT).join(&state.path))
.unwrap() .unwrap()
.filter_map(|res| { .filter_map(|res| {
res.and_then(|d| { res.and_then(|d| {