broot icon indicating copy to clipboard operation
broot copied to clipboard

Backslashes are treated as escape characters

Open kabeep opened this issue 1 month ago • 1 comments

Environment

  • Git Bash version: 5.2.15
  • Operating System: Windows 11
  • Broot version: 1.53.0

What happened

~/.bashrc :

source C:\Users\me\...\bash\br treated as source C:Usersme...bashbr

~\...\dystroy\broot\config\launcher\bash :

cd C:\Users\me\...\directory treated as cd C:Usersme...directory

Fix that works for me

function br {
    local cmd cmd_file code
    cmd_file=$(mktemp)
    if broot --outcmd "$cmd_file" "$@"; then
        cmd=$(sed 's/\\/\\\\/g' "$cmd_file")      # Only Changed here
        command rm -f "$cmd_file"
        eval "$cmd"
    else
        code=$?
        command rm -f "$cmd_file"
        return "$code"
    fi
}

kabeep avatar Nov 15 '25 12:11 kabeep

I'd like somebody else on Windows to check this.

Canop avatar Nov 15 '25 14:11 Canop