[英]saving file in Assets folder in Windows 8 App
I am developing an App for Windows Store. 我正在开发Windows应用商店的应用程序。 I have to save a recorded media as "file1.mp3" into the Assets folder without opening the save file prompt. 我必须将录制的媒体作为“ file1.mp3”保存到Assets文件夹中,而无需打开保存文件提示。 I used the following code 我用下面的代码
StorageFile file = await Windows.ApplicationModel.Package.Current.InstalledLocation.CreateFileAsync(@"Assets\\file1.mp3",Windows.Storage.CreationCollisionOption.ReplaceExisting);
However the system returns an "access denied" error. 但是,系统返回“访问被拒绝”错误。 The file has to be saved in the Assets directory only and I do not want to use FileSavePicker
. 该文件仅必须保存在Assets目录中,并且我不想使用FileSavePicker
。 Please Help. 请帮忙。
Thanks 谢谢
Your package folder is read-only. 您的软件包文件夹是只读的。 Use your app data folders from Windows.Storage.ApplicationData.Current instead, wherein you'll find a LocalFolder and TemporaryFolder (also RoamingFolder but an mp3 would exceed the 100KB roaming limit). 请改用Windows.Storage.ApplicationData.Current中的应用程序数据文件夹,在其中您将找到LocalFolder和TemporaryFolder(也是RoamingFolder,但mp3会超过100KB漫游限制)。 Then you can use either folder's CreateFileAsync. 然后,您可以使用任何一个文件夹的CreateFileAsync。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.