-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add support for PathSeparator property in Providers #8587
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
Add support for PathSeparator property in Providers #8587
Conversation
src/System.Management.Automation/namespaces/FileSystemProvider.cs
Outdated
Show resolved
Hide resolved
|
@renehernandez Thanks for your contribution! I added 'Fix #5544' to link the issue and auto close it after we merge. The public API should be approved by PowerShell Committee. |
test/powershell/Modules/Microsoft.PowerShell.Management/Get-PSProvider.Tests.ps1
Outdated
Show resolved
Hide resolved
|
@PowerShell/powershell-committee reviewed this and is ok with adding |
|
This PR has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 10 days. |
|
@daxian-dbw Is this going to be merged at all? The changes are pretty small and they shouldn't be to hard to review. Or is there anything left that should be addressed?? |
|
@renehernandez Sorry for having this PR slip off my radar. I will do the review later today. |
src/System.Management.Automation/engine/DataStoreAdapterProvider.cs
Outdated
Show resolved
Hide resolved
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.
Similar method should be added for Environment, Alias, Certificate and WSMan providers.
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 have yet to add it for the WSMan provider. The reason is that WSMan provider is in a different namespace, thus would require to change classes in the Utils file to have public scope
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.
What you should be the outcome here? Should I change the relevant classes' scope?
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.
Good point. I think we can use a new instance of ReadOnlyCollection<string> for WSMan.
test/powershell/Modules/Microsoft.PowerShell.Management/Get-PSProvider.Tests.ps1
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/DataStoreAdapterProvider.cs
Outdated
Show resolved
Hide resolved
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.
Just wondering, should we allow string that is more than 1 chars to be used as the path separator? Maybe ReadOnlyCollection<char>?
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.
Also, as for the default value of this property, maybe it should be null by default?
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.
Do you want me to apply these changes?
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 agree with the changes.
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 want to be discreet here as it's a public API.
@SteveL-MSFT @joeyaiello what do you think?
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.
@daxian-dbw's feedback makes sense to me. I'm not aware of any situation where the separator is more than a single character.
test/powershell/Modules/Microsoft.PowerShell.Management/Get-PSProvider.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Management/Get-PSProvider.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Management/Get-PSProvider.Tests.ps1
Outdated
Show resolved
Hide resolved
|
@renehernandez When you are addressing my comments, can you please add the |
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.
Mostly looks good to me. Thanks! Let's wait for Steve and Joe's feedback on string vs. char.
Can you please rebase when push your next commit?
can you please add the
[Feature]tag to the last commit's message? I would like the CI to run all feature tests for this PR.
And please, add the [Feature] tag to the last commits's message. Thanks
test/powershell/Modules/Microsoft.PowerShell.Management/Get-PSProvider.Tests.ps1
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/DataStoreAdapterProvider.cs
Outdated
Show resolved
Hide resolved
668381c to
8f44042
Compare
|
@renehernandez I think we need to implement the Then, add a public-getter-private-setter property Then, in the Then, in each provider implementation, override that property to provide the supported separators. |
|
@daxian-dbw Are you suggesting a rename as part of the change? Should the property be plural, i.e. |
@renehernandez If we look at how |
|
@PowerShell/powershell-committee Need your another review on three items:
public virtual ReadOnlyCollection<string> PathSeparators => Utils.EmptyReadOnlyCollection<string>(); |
|
Here's my 2¢:
|
|
@SteveL-MSFT: Please see #9244 |
Add PathSeparator values for FileSystem, Function, Variable and Registry providers Add corresponding tests
Fix that changes in a copy of the separator array could affect subsequent calls of the PathSeparator property Add test
Use test data accordingly to OS, ie. windows vs Unix-like Fix expected values for providers for unix-like system
Add PathSeparator property to Env, Cert and Alias provider Add test for property being read-only Consolidate separator list in Separators class
Remove invalid test cases for nonwindows os
Remove unused overrides for Start method Add tests for WSMan in ConfigProvider tests
Remove unused properties added to internal Separator class Fix xml documentation
Remove unused namespace Fix xml documentation tag Remove base prefix from expression body
Rebase from master
50c7127 to
a905ca0
Compare
daxian-dbw
left a comment
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.
Just realized new commits were pushed. This looks good to me. Thank you @renehernandez!
Have we a tracking issue? |
|
The issue tracking registry provider is #5536 |
|
@renehernandez Thank you again for your contribution and patience! |
PR Summary
Fix #5544.
Add two properties in
ProviderInfoclass:ItemSeparatorandAltItemSeparator.On windows, the default values for those two properties are
ItemSeparator = '\'andAltItemSeparator = '/'.On unix, the default values for those two properties are
ItemSeparator = '/'andAltItemSeparator = '\'.Registry provider is the only exception, both properties for it have the value
\.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests