-
Notifications
You must be signed in to change notification settings - Fork 393
Allow relative settings path #909
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
Allow relative settings path #909
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little concerned with the approach. PS can actually resolve the path before it is handed off to the lower level routines. What do you think of the following? (line 296 or so in InvokeScriptAnalyzerCommand.cs)
try {
// Attempt to convert the settings into a path
ProviderInfo resolvedProvider = null;
var resolvedSettingPaths = GetResolvedProviderPathFromPSPath(settings.ToString(), out resolvedProvider);
if ( resolvedSettingPaths != null ) {
settings = resolvedSettingPaths.FirstOrDefault<string>();
}
}
catch { ; }
FWIW, there are alot of cmdlets which do something similar. Then you can drop changes in Engine/Settings.cs
.
Thanks for the feedback, I did not know that there is a neater way pf resolving the path and in general I would approve doing that. |
I noticed that clever business with regard to the hashtable vs. string, but I put it in the cmdlet because that's traditionally where resolution code resides (rather than the engine). I suppose it could be put in the actual setter of the parameter and in the case that it's given a string, only then attempt the path resolution, or moved to the engine for that matter. I don't have a problem with a different location for the resolution, I was just following a different pattern. |
Using some delegate trickery (due to the resolver method having an |
looks great |
PR Summary
Fixes #908 to make it possible to specify a relative path for the
-Settings
paramater.PR Checklist
Note: Tick the boxes below that apply to this pull request by putting an
x
between the square brackets. Please mark anything not applicable to this PRNA
.WIP:
to the beginning of the title and remove the prefix when the PR is ready