Skip to content

Handle symbolic links pointing to files #1

@SakolB

Description

@SakolB

Description

Currently, when a symbolic link points to a directory, bcd correctly cd's into it. However, when a symbolic link points to a file, the behavior is unclear or may not work as expected.

Expected Behavior

When selecting a symbolic link that points to a file, bcd should cd into the parent directory of the symlink itself (not the target file's directory).

Example:

/home/user/projects/mylink -> /etc/config/file.conf

When selecting mylink, should cd to /home/user/projects/

Current Behavior

Unknown - needs testing to confirm current behavior with file symlinks.

Proposed Solution

  1. Detect if the selected path is a symbolic link
  2. If it points to a file, resolve to the symlink's parent directory
  3. If it points to a directory, keep current behavior (cd into it)

Implementation Location

  • Shell integration functions (scripts/bcd.bash, scripts/bcd.zsh, scripts/bcd.fish)
  • The logic in the if [[ -f "$selected_path" ]] branch may need to check for symlinks

Acceptance Criteria

  • Selecting a symlink pointing to a file cd's to the symlink's parent directory
  • Selecting a symlink pointing to a directory cd's into that directory
  • Selecting a regular file cd's to its parent directory (existing behavior)
  • Selecting a regular directory cd's into it (existing behavior)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions