matthewjberger / scoop-nerd-fonts

A scoop bucket for installing nerd fonts
The Unlicense
372 stars 36 forks source link

fix: `Copy-Item : Cannot find path` error in powershell 6 #8

Closed Retia-Adolf closed 5 years ago

Retia-Adolf commented 5 years ago

For example, currently installer script gives me error like:

Copy-Item : Cannot find path 'C:\Users\foo\scoop\apps\sarasagothic\0.8.0\C:\Users\foo\scoop\apps\sarasagothic\0.8.0\sarasa-ui-hc-extralightitalic.ttf' because it does not exist.
At line:3 char:3
+   Copy-Item "$dir\$_" -destination "$env:windir\Fonts"
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (C:\Users\foo...lightitalic.ttf:String) [Copy-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand
matthewjberger commented 5 years ago

This pull request breaks functionality for Powershell versions lower than 6.

I believe the error occurs because of the change to the Get-ChildItem cmdlet in Powershell 6:

Updated Get-ChildItem to work more like the *nix ls -R and the Windows DIR /S native commands. Get-ChildItem now returns the symbolic links encountered during a recursive search and does not search the directories that those links target. (#3780)

This may need a more involved solution