Access single file or folder from IStorageFolder by name #17771
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
This PR addresses #17276. It allows to access a single file or folder by name given you have already a folder (
IStorageFolder
).What is the current behavior?
You can currently archive this by iteration over the whole folder with
GetItemsAsync()
and pick the file with the given name. This has performance considerations and therefore, when applicable, the implementations tries to access the file directly.What is the updated/expected behavior with this PR?
When you get a folder (
IStorageFolder
) e.g through a file-picker, you can access the child file/folder by name directly, returningIStorageFile
orIStorageFolder
depending on the called method.How was the solution implemented (if it's not obvious)?
The interface
IStorageFolder
was extended as follows:Therefore, an implementation for the following platforms was provided:
Testing
Tested it on following platforms:
Extended the ControlCatalog for testing:
Checklist
Breaking changes
No breaking changes, this only extends the public interface
Fixed issues
Fixes #17276