File/Directory Access for Windows 10 Universal Apps
After migrating from WPF to Windows Universal Apps, access to files and directories outside the app storage is restricted.
Directory.Exists method is not available
UWP apps do not support the Directory.Exists method.
Access files outside of app storage
By default, UWP apps can only access certain directories and files:
- Directories declared in the manifest file
- User-selected directory via FileOpenPicker or FolderPicker
- Files from FutureAccessList or MostRecentlyUsedList
- Associate or share open files by file extension
Solution
Use FutureAccessList and FolderPicker:
- Declare the "futureAccessList" function in the app manifest.
- Use FolderPicker to allow the user to select a directory.
- Add directory to FutureAccessList.
Grant broad file system access (Windows 10, version 17134 and later):
- Declare the "broadFileSystemAccess" function in the app manifest.
- Submit your app to the App Store for review.
- If approved, the app will gain access to the entire file system based on user consent.
Additional notes:
- FutureAccessList method remains valid after application restart.
- The "broadFileSystemAccess" feature grants broad access and therefore requires additional review and runtime user consent.
- Apps must be able to cope with access being denied.
The above is the detailed content of How Can Universal Windows Platform (UWP) Apps Access Files and Directories Outside Their Storage?. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn