My program handles all the files specified by the user. After preferable to retain the modified file to the directory of the source file. StorageFolder.GetFolderFromPathAsync
method returns "Access Denied"
.
File type associations in the manifest can not be added because after processing the files retain their extension. And what kind of file (with any extension), the user chooses to say impossible.
The code in which an error occurs.
internal async static void SetFile(List<byte> byteArray , StorageFile file)
{
try
{
string path = Path.GetDirectoryName(file.Path);
StorageFolder newFolder = await StorageFolder.GetFolderFromPathAsync(path);
StorageFile newFile = await newFolder.CreateFileAsync(string.Format(@"crt{0}", Path.GetFileName(file.Name)), CreationCollisionOption.FailIfExists);
Stream stream = await file.OpenStreamForWriteAsync();
BinaryWriter writer = new BinaryWriter(stream);
writer.Write(byteArray);
writer.Flush();
}
catch (Exception ex)
{
throw ex;
}
}
StorageFile file - file that the user specified. I'm trying to create a new folder based on the path of the source file. An error - "Access Denied". To access this folder, i must register the file extensions that I use. It is impossible. Tell me, please, can we get around it as that? Or what can be done in my case?