Reputation: 675
CreateDirectory and Path.Combine doesn't seem to work on Windows 8 applications. How could I substitute it?
My first intention was to create a folder inside %APPDATA%, but
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
(something like that, I don't quite remember) doesn't work on Windows 8 apps. So I tried to get the documents library by using
KnownFolders.DocumentsLibrary
but I don't know how to create a folder inside it.
Upvotes: 0
Views: 319
Reputation: 14328
DocumentsLibrary
returns a storage folder:
StorageFolder documents = KnownFolders.DocumentsLibrary;
Now the StorageFolder, or maybe I should say its interface, IStorageFolder
has a method CreateFolderAsync
with two overloads. The simplest one:
StorageFolder newFolder = await documents.CreateFolderAsync("MyDir");
Other overload specifies the behavior when there's a directory name collision.
Upvotes: 1