Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception on first import #33

Closed
wekempf opened this issue Sep 25, 2017 · 1 comment
Closed

Exception on first import #33

wekempf opened this issue Sep 25, 2017 · 1 comment

Comments

@wekempf
Copy link

wekempf commented Sep 25, 2017

The first time you import the module on a new system you receive the following.

PS> import-module z
Get-Content : Cannot find path 'C:\Users\bkempf\.cdHistory' because it does not exist.
At C:\Users\bkempf\Documents\WindowsPowerShell\Modules\z\1.1.7\z.psm1:624 char:20
+ ... global:history += Get-Content -Path $cdHistory -Encoding UTF8 | ? { ( ...
+                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\bkempf\.cdHistory:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

I don't have time to look at the code or provide a PR, but simply wrapping this functionality with a Test-Path check would fix it.

@badmotorfinger
Copy link
Owner

Thanks for taking the time to log this issue.

Issue resolved. You can grab the latest version for the PowerShell gallery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants