{"id":664,"date":"2016-12-16T17:20:24","date_gmt":"2016-12-16T17:20:24","guid":{"rendered":"https:\/\/ibex.tech\/windows-iot\/?p=252"},"modified":"2022-09-13T15:39:06","modified_gmt":"2022-09-13T14:39:06","slug":"file-and-folder-locations","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/uwp-programming-in-c\/files\/file-and-folder-locations","title":{"rendered":".File and Folder Locations"},"content":{"rendered":"<h4>\n\tFile&nbsp;And Folder Locations<\/h4>\n<h5>\n\tApp Data<\/h5>\n<p>Private data that an app reads and writes. &nbsp;Normally not directly exposed to users, and one app cannot view app data from another app.<\/p>\n<p>When an app is uninstalled&nbsp;all of its app data automatically gets deleted as well.<\/p>\n<p>There are two types:<\/p>\n<p style=\"margin-left: 40px\">\n\tapp settings<\/p>\n<p style=\"margin-left: 80px\">\n\tAccess available via the Windows.Storage.ApplicationData class.<\/p>\n<p style=\"margin-left: 80px\">\n\tSmall, primitive values that are easy to store and retrieve.<\/p>\n<p style=\"margin-left: 40px\">\n\tapp files<\/p>\n<p style=\"margin-left: 80px\">\n\tAccess available via the Windows.Storage.ApplicationData class.<\/p>\n<p style=\"margin-left: 80px\">\n\tRegular files on the local file system&nbsp;but in a private location specific to your app. You can interact with app files without needing any capabilities. &nbsp;<\/p>\n<h5>\n\tSecurity data (e.g. usernames and passwords)<\/h5>\n<p>Use PasswordVault for a secure srotage similar to app data but with security. &nbsp;Even better, use WebAuthenticationBroker if you can.<\/p>\n<h5>\n\tFiles That Were Packaged With Your App<\/h5>\n<pre><code>\n\tWindows.Storage.StorageFolder folder = Windows.ApplicationModel.Package.Current.InstalledLocation;\n\tWindows.Storage.StorageFile file = await folder.GetFileAsync(\"Assets\\\\SomeFile.txt\");\n<\/code><\/pre>\n<h4>\n\tAccessing Other Files<\/h4>\n<p>UWP applications can only use the KnownFolders for storage, no access is allowed to the wider core file system.<\/p>\n<p>An exception to this is directories and files which the user manually selects&nbsp;with the FileOpenPicker or FolderPicker.<\/p>\n<h5>\n\tAccessing USB drive files<\/h5>\n<p>See <a href=\"https:\/\/ibex.tech\/windows-iot\/windows-iot\/uwp-programming-in-c\/files\/usb-drives-memory-sticks-etc\">here<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>File&nbsp;And Folder Locations App Data Private data that an app reads and writes. &nbsp;Normally not directly exposed to users, and one app cannot view app data from another app. When an app is uninstalled&nbsp;all of its app data automatically gets deleted as well. There are two types: app settings Access available via the Windows.Storage.ApplicationData class. [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[135],"tags":[],"class_list":["post-664","post","type-post","status-publish","format-standard","hentry","category-files"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/comments?post=664"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/664\/revisions"}],"predecessor-version":[{"id":1186,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/664\/revisions\/1186"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}