以下列出了應用程序中的「資產」文件夾中的文件並正確運行。音樂庫文件夾中的uwp javascript列表文件
// Get the path to the app's Assets folder.
var root = Windows.ApplicationModel.Package.current.installedLocation.path;
var path = root + "\\Assets";
//var path = Windows.Storage.KnownFolders.musicLibrary;
var StorageFolder = Windows.Storage.StorageFolder;
var folderPromise = StorageFolder.getFolderFromPathAsync(path);
folderPromise.done(function getFolderSuccess(folder) {
var filesInFolderPromise = folder.getFilesAsync();
filesInFolderPromise.done(function getFilesSuccess(filesInFolder) {
s = "";
filesInFolder.forEach(function forEachFile(item) {
s = s + item.name + "<br />";
});
document.getElementById('filelist').innerHTML = s;
});
});
我想修改它以列出musicLibrary中的文件。當我改變的路徑名
var path = Windows.Storage.KnownFolders.musicLibrary;
我得到
JavaScript runtime error: The parameter is incorrect
請幫我用適當的語法。音樂庫功能在清單中設置。