Skip to content

Commit

Permalink
update path, and use append instead of insert for prefix_path()
Browse files Browse the repository at this point in the history
  • Loading branch information
MLFlexer committed Jul 23, 2024
1 parent 51a2bae commit d923571
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config/src/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,19 @@ pub fn make_lua_context(config_file: &Path) -> anyhow::Result<Lua> {
let mut path_array: Vec<String> = package_path.split(";").map(|s| s.to_owned()).collect();

fn prefix_path(array: &mut Vec<String>, path: &Path) {
array.insert(0, format!("{}/?.lua", path.display()));
array.insert(1, format!("{}/?/init.lua", path.display()));
array.push(format!("{}/?.lua", path.display()));
array.push(format!("{}/?/init.lua", path.display()));
}

prefix_path(&mut path_array, &crate::HOME_DIR.join(".wezterm"));
prefix_path(&mut path_array, &crate::DATA_DIR.join("plugins").join("aliases"));
for dir in crate::CONFIG_DIRS.iter() {
prefix_path(&mut path_array, dir);
}
path_array.insert(
2,
format!("{}/plugins/?/plugin/init.lua", crate::DATA_DIR.display()),
);
prefix_path(&mut path_array, &crate::DATA_DIR.join("plugins"));

if let Ok(exe) = std::env::current_exe() {
if let Some(path) = exe.parent() {
Expand Down

0 comments on commit d923571

Please sign in to comment.