Reputation: 1471
Since UWP are very restrictive in terms of read/write on files that are out of the package, I was wondering whether there is a good place where I can create a folder structure and then create some text files in it...
I was thinking on using %localappdata% but I get access denied.
I know we have available the Videos, Music, etc. folders but these don't make sense to my logic. (e.g.: doesn't make sense to store a txt file in the Music folder)
Can someone point me to where to store extra files?
Upvotes: 0
Views: 300
Reputation: 169420
There is a a Local folder, a Roaming folder and a Temp folder in each app to which you can write folders and files.
// Create sample file; replace if exists.
Windows.Storage.StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
Windows.Storage.StorageFile sampleFile = await storageFolder.CreateFileAsync("sample.txt", Windows.Storage.CreationCollisionOption.ReplaceExisting);
Please refer to Jerry Nixon's blog post for more information: http://blog.jerrynixon.com/2012/06/windows-8-how-to-read-files-in-winrt.html
Upvotes: 3