Reputation: 177
Hello i have this code
private async Task SaveImageToIsolatedStorage(Stream stream)
{
StorageFolder Datafolder = await ApplicationData.Current.LocalFolder.GetFolderAsync("Data");
StorageFolder subfolder1 = await Datafolder.GetFolderAsync("subfolder1");
StorageFolder subfolder2 = await subfolder1 .GetFolderAsync("subfolder2");
StorageFile file = await subfolder2.CreateFileAsync("test.jpg", CreationCollisionOption.ReplaceExisting);
using (Stream current = await file.OpenStreamForWriteAsync())
{
await stream.CopyToAsync(current);
}
}
if i use directly StorageFolder.GetFolderFromPathAsync("Data\subfolder1\subfolder2") receive error
{System.IO.FileNotFoundException: The system cannot find the file specified
how to?
Upvotes: 0
Views: 1421
Reputation: 177
ok it work with this code
StorageFolder folder= await ApplicationData.Current.LocalFolder.GetFolderAsync("Data\\subfolder\\subfolder1");
Upvotes: 0
Reputation: 1798
According to a post on msdn you need to use double slashes:
StorageFolder.GetFolderFromPathAsync("Data\\subfolder1\\subfolder2")
Upvotes: 1