0

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.

4

1 回答 1

1

DocumentsLibrary返回一个存储文件夹:

StorageFolder documents = KnownFolders.DocumentsLibrary;

现在 StorageFolder,或者我应该说它的接口,IStorageFolder有一个CreateFolderAsync带有两个重载的方法。最简单的一个:

StorageFolder newFolder = await documents.CreateFolderAsync("MyDir");

其他重载指定目录名称冲突时的行为。

于 2013-05-19T17:51:04.317 回答