diff --git a/src/code/SavePSResource.cs b/src/code/SavePSResource.cs index 73b6d1c19..349be51ca 100644 --- a/src/code/SavePSResource.cs +++ b/src/code/SavePSResource.cs @@ -91,8 +91,12 @@ public string Path set { string resolvedPath = string.Empty; - if (!string.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { + // If the user does not specify a path to save to, use the user's current working directory + resolvedPath = SessionState.Path.GetResolvedPSPathFromPSPath(SessionState.Path.CurrentFileSystemLocation.Path).First().Path; + } + else { resolvedPath = SessionState.Path.GetResolvedPSPathFromPSPath(value).First().Path; } @@ -155,12 +159,6 @@ protected override void BeginProcessing() // This is to create a better experience for those who have just installed v3 and want to get up and running quickly RepositorySettings.CheckRepositoryStore(); - // If the user does not specify a path to save to, use the user's current working directory - if (string.IsNullOrWhiteSpace(_path)) - { - _path = SessionState.Path.CurrentLocation.Path; - } - _installHelper = new InstallHelper(cmdletPassedIn: this); }