Username with one or more spaces causes an error
2gn opened this issue · comments
Steps to reproduce
- (optional) change your username to include one or more spaces
- If you have already br installed, run
br --install
- run
broot --install
- the command above creates $HOME\Documents\WindowsPowershell\Profile.ps1 with the following contents
(when username is "User Name")
. C:\Users\User\ Name\AppData\Roaming\dystroy\broot\config\launcher\powershell\br.ps1
Possible solution
Use $HOME environment variable instead so windows will automatically expand it on execution appropriately.
Using $HOME directly in the command isn't something you can do when creating a file in a program, you have to expand the path.
But an appropriate escaping is probably missing.
This also happens when trying to use inshellisense, by the way.
PS …\User Name\Development> inshellisense
'C:\Users\User' is not recognized as an internal or external command,
operable program or batch file.
It seems there are two errors that should be resolved.
- issue above
- File not found error
PS …\Development\broot> br
File not found: "C:\\Users\\User Name\\AppData\\Local\\Temp\\tmpBA8F.tmp"
broot/src/shell_install/powershell.rs
Lines 27 to 33 in 8f50c72
In line 29 of powershell.rs, (New-TemporaryFile).FullName
is expanded inside string expression. That's causing the error.
Plus, I noticed that broot --install
patches the script only for natively installed powershell, and doesn't work with powershell core, which is newer. I'll make a different PR/issue for this.