My program processes all files specified by the user. After the preferred save the modified file to the directory of the source file. StorageFolder.GetFolderFromPathAsync returns "Access Denied" .
It is not possible to add file type associations to the manifest because the files retain their extension after processing. And which file (with any extension) the user chooses to say impossible. The code in which the 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 - The file specified by the user. I am trying to create a new folder based on the path of the source file. Error - "Access Denied." In order to access this folder, I have to register the file extensions that I use. It's impossible. Please tell me can we get around this? Or what can be done in my case?
source share