From d023e23800a07826a3c0b1d7949ca725b51ed7cc Mon Sep 17 00:00:00 2001 From: Amber Erickson Date: Mon, 1 Aug 2022 14:52:51 -0700 Subject: [PATCH 1/2] Change default path to CurrentFileSystemLocation --- src/code/SavePSResource.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/code/SavePSResource.cs b/src/code/SavePSResource.cs index 73b6d1c19..5a47b593c 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).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); } From 76bccaea9c9c1a09ce33da7628be95c12d92d809 Mon Sep 17 00:00:00 2001 From: Amber Erickson Date: Tue, 2 Aug 2022 10:39:01 -0700 Subject: [PATCH 2/2] Add path to CurrentFileSystemLocation --- src/code/SavePSResource.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/code/SavePSResource.cs b/src/code/SavePSResource.cs index 5a47b593c..349be51ca 100644 --- a/src/code/SavePSResource.cs +++ b/src/code/SavePSResource.cs @@ -94,7 +94,7 @@ public string Path 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).First().Path; + resolvedPath = SessionState.Path.GetResolvedPSPathFromPSPath(SessionState.Path.CurrentFileSystemLocation.Path).First().Path; } else { resolvedPath = SessionState.Path.GetResolvedPSPathFromPSPath(value).First().Path;