neofetch: Enclose script name in double quotes (#3114)

* Escape single quotes and spaces in the path of neofetch fed as an argument to bash.exe in "pre_install" property

Many windows usernames contain spaces or single quotes/apostrophe. I accidentally have an apostrophe (') in my username. As a result neofetch fails to run as mentioned in detail [here](https://github.com/dylanaraps/neofetch/issues/2002#issue-1084846469)

I discovered that the fix to this issue is to surround the path of the neofetch script being passed as an argument to bash.exe in double-quotes. This would escape spaces and single quotes in username. Windows does not allow double quotes or backslashes in usernames, so there is no need to consider those.

This is the updated working script: https://pastebin.com/J0zTeNAw
I tried to escape my double quotes in the json file with backslashes, please check if it corresponds to my intent.

* Update neofetch.json

Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
This commit is contained in:
nasseef20 2021-12-21 19:53:18 +06:00 committed by GitHub
parent 83e8525a4b
commit 351ab03c49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,7 @@
"hash": "3dc33493e54029fb1528251552093a9f9a2894fcf94f9c3a6f809136a42348c7",
"pre_install": [
"if(installed 'git-with-openssh') { $git = 'git-with-openssh' } else { $git = 'git' }",
"Write-Output \"`$GitDir = (Get-Item `$(scoop which $git) -ErrorAction:Stop).Directory.Parent; if (`$GitDir.FullName -imatch 'mingw') { `$GitDir = `$GitDir.Parent }; & `$(Join-Path (Join-Path `$GitDir.FullName 'bin') 'bash.exe') `$(Join-Path `$PSScriptRoot 'neofetch') @args\" | Out-File \"$dir\\neofetch.ps1\" -Encoding utf8"
"Write-Output \"`$GitDir = (Get-Item (scoop which $git) -ErrorAction:Stop).Directory.Parent; if (`$GitDir.FullName -imatch 'mingw') { `$GitDir = `$GitDir.Parent }; & (Join-Path (Join-Path `$GitDir.FullName 'bin') 'bash.exe') `\"`$(Join-Path `$PSScriptRoot 'neofetch')`\" @args\" | Out-File \"$dir\\neofetch.ps1\" -Encoding utf8"
],
"bin": "neofetch.ps1",
"checkver": "github",