Skip to content

Commit

Permalink
Use logical_dir for contracting the home directory
Browse files Browse the repository at this point in the history
  • Loading branch information
deadalusai committed Jan 11, 2021
1 parent 892ce25 commit 54874f5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/directory.rs
Expand Up @@ -40,6 +40,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let config: DirectoryConfig = DirectoryConfig::try_load(module.config);

let home_dir = dirs_next::home_dir().expect("Unable to determine HOME_DIR for user");

let physical_dir = &context.current_dir;
let logical_dir = if config.use_logical_path {
context.logical_dir.as_ref().unwrap_or(&context.current_dir)
Expand Down Expand Up @@ -83,7 +84,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
// fish-style path contraction together
if config.fish_style_pwd_dir_length > 0 && config.substitutions.is_empty() {
// If user is using fish style path, we need to add the segment first
let contracted_home_dir = contract_path(&physical_dir, &home_dir, HOME_SYMBOL);
let contracted_home_dir = contract_path(&logical_dir, &home_dir, HOME_SYMBOL);
to_fish_style(
config.fish_style_pwd_dir_length as usize,
contracted_home_dir,
Expand Down

0 comments on commit 54874f5

Please sign in to comment.