2013-08-25 63 views
0

我有这个奇怪的问题。我有一个可以使用此代码WinRT Acces denied to file

var playlist = new Windows.Media.Playlists.Playlist(); 
... 
WinJS.Utilities.id("appbar-save-button").listen("click", function() 
     { 
      var savePicker = new Windows.Storage.Pickers.FolderPicker(); 
      savePicker.fileTypeFilter.append("*"); 

      savePicker.pickSingleFolderAsync().then(function (folder) 
      { 
       playlist.saveAsAsync(folder, "My Playlist", Windows.Storage.NameCollisionOption.replaceExisting, Windows.Media.Playlists.PlaylistFormat.windowsMedia); 
      }); 

     }) 

问题是当我试图进入电影这个文件与此代码

WinJS.Utilities.id("appbar-open-button").listen("click", function() 
     { 
      var openPicker = Windows.Storage.Pickers.FileOpenPicker(); 

      openPicker.fileTypeFilter.append(".wpl"); 
      openPicker.pickSingleFileAsync().then(function (file) 
      { 
       Windows.Media.Playlists.Playlist.loadAsync(file).then(function (playlist) 
       { 
        // Print the name of the playlist. 
       }); 
      }); 

     }) 

在注释行创建播放列表的应用程序,我得到一个异常:Cannot access the specified file or folder (⑰ᑲÕ). The item is not in a location that the application has access to (including application data folders, folders that are accessible via capabilities, and persisted items in the StorageApplicationPermissions lists). Verify that the file is not marked with system or hidden file attributes.

我已经给应用程序文档库功能与类型.wpl的文件类型关联,但我仍然得到此异常。我怎样才能解决这个问题

编辑:添加视频到未来的存取权限列表似乎解决了应用程序创建的播放列表的问题,但对于随机播放列表的问题仍然存在。

回答

3

就我所见,问题不在于加载“播放列表”文件的权限;如果在计算机的任何位置选择文件,则使用文件选择器,用户将访问该文件;这同样适用于文件夹选择器,在该文件夹选择器中可以访问文件夹中的所有文件。之后,如果选定的文件/文件夹被添加到FutureAccessList,文件夹/文件也将在以后访问。

播放列表中可能包含用户无法访问的文件夹中的文件。要确认这一点,请尝试打开一个播放列表,在音乐库位置中只有文件或文件 - 在提供应用程序“音乐库”功能之后。如果这样做 - 应用程序需要设置以添加音乐文件夹。将包含所选文件夹中的文件的播放列表只会加载。

+0

我有点想到问题不在播放列表文件中,而是视频中。试图将文件中的视频添加到未来的访问列表(或将它们移动到音乐库中)并且它可以正常工作。 –

相关问题