Reputation: 410
Is there any way to read for example all the directories/files in a drive/folder within a Windows 8 Store application? I have googled and nothing except reading the known folders (documents, pictures, etc.), maybe you guys/girls can help me out.
Thanks!
Upvotes: 2
Views: 3156
Reputation: 41
You can access drive and folder in this way but it require capabilities to be turned on from packageManifest
StorageFolder folder5 = await StorageFolder.GetFolderFromPathAsync(@"Z:\");
Upvotes: 0
Reputation: 1602
In WinStore app, access to files/folders is restricted.
You have access to app's installation folder, accessible by Windows.ApplicationModel.Package.Current.InstalledLocation.
And you can access known folders (docs, pictures, videos, etc), through KnownFolders class. You have to decrare the appropriate capability. For example, if you need access to VideosLibrary folder, you have to define VideosLibrary capability.
Files from other locations are accessible only by FilePicker.
For more info, please, look at:
File access and permissions in Windows Store apps (Windows)
App capability declarations (Windows Store apps) (Windows)
Integrating with file picker contracts(Windows Store apps) (Windows)
Upvotes: 3
Reputation: 3162
From my experience, you can't scan an arbitrary folder/drive on the system. WinRT APIs limit your reach to the user's "Known Folders".
This is consistent with the rest of the Windows experience, where all media are expected to live in their respective libraries. You wouldn't need to look for movies outside the Video library.
Upvotes: 0