Canop / broot

A new way to see and navigate directory trees : https://dystroy.org/broot
MIT License
10.64k stars 234 forks source link

git bash: init command in `.bashrc` and `.bash_profile` fails to run on Windows #845

Open Doekin opened 7 months ago

Doekin commented 7 months ago

Behavior

Git bash launches with error: No such file or directory

bash: C:UsersleemuAppDataRoamingdystroybrootconfiglauncherbashbr: No such file or directory
bash: C:UsersleemuAppDataRoamingdystroybrootconfiglauncherbashbr: No such file or directory

image

Possible cause

The path of init script in .bashrc and .bash_profile contains backslash that is mistakenly parsed as escape character source C:\Users\leemu\AppData\Roaming\dystroy\broot\config\launcher\bash\br

Possible solution

Quote the path. It works on git bash (Windows10) and bash/zsh (Linux)

Doekin commented 7 months ago

By the way, init script runs twice when .bashrc and .bash_profile both exists

AeliusSaionji commented 3 months ago

By the way, init script runs twice when .bashrc and .bash_profile both exists

This is probably a generic issue that deserves its own thread, mind creating that? I imagine it's not Windows specific.

Git bash launches with error: No such file or directory

For clarity: git bash uses a fork of msys2, and this issue falls under the umbrella of Windows cygwin/msys2 problems.

The problem occurs as a result of cygpath.exe's path translation. image

However, cygpath is correct to do this, because it ensures that paths with spaces in them work correctly. image

For completion's sake, I should note that forward slash is fine too image