badmotorfinger / z

Save time typing out directory paths in PowerShell by jumping around instead.
The Unlicense
434 stars 33 forks source link

"Cannot bind argument to parameter 'FilePath' because it is null" on Ubuntu #44

Closed joejag closed 4 years ago

joejag commented 4 years ago

Hello, I'm using:

$PSVersionTable          

Name                           Value
----                           -----
PSVersion                      6.2.4
PSEdition                      Core
GitCommitId                    6.2.4
OS                             Linux 4.15.0-76-generic #86~16.04.1-Ubuntu SMP Mon Jan 20 11:02:50 UTC 2020
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

I've just ran an Install-Module z -AllowClobber -Scope CurrentUser and tried this plugin for the first time. As soon as a 'cd' to another directory I get an error in my terminal saying:

System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'FilePath' because it is null.
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

I think this is down to using $ENV:USERPROFILE rather than the interop version of $ENV:HOME at this line: https://github.com/vincpa/z/blob/master/z.psm1#L1

That made the error go away locally for me, but the plugin still didn't seem to work right. Is there any interest in making this plugin work on platforms other than Windows? I'd be happy to make it work if a PR would be accepted?

Thank you, Joe.

badmotorfinger commented 4 years ago

Hi @joejag

Thanks for taking the time to create an issue and for showing interesting in making this work on Core.

I would be more than happy to accept a PR to get this working. I've had quite a few people over the years ask me about this but I've never had the time (nor an installation of Linux) to make it a reality.

I'd be more than happy to not only accept the PR but ensure it still works on Windows.

Cheers.