[Downloader] Fix Downloader.downloadedRevisions methods

The methods should take into account that there's no downloads
folder.

This was broken in 20fb1f6b9b
This commit is contained in:
Andrey Lushnikov 2017-07-12 14:54:48 -07:00
parent 20fb1f6b9b
commit b3d38a1b8d

View File

@ -109,6 +109,8 @@ module.exports = {
* @return {!Array<!{platform:string, revision: string}>} * @return {!Array<!{platform:string, revision: string}>}
*/ */
downloadedRevisions: function() { downloadedRevisions: function() {
if (!fs.existsSync(DOWNLOADS_FOLDER))
return [];
let fileNames = fs.readdirSync(DOWNLOADS_FOLDER); let fileNames = fs.readdirSync(DOWNLOADS_FOLDER);
return fileNames.map(fileName => parseFolderPath(fileName)).filter(revision => !!revision); return fileNames.map(fileName => parseFolderPath(fileName)).filter(revision => !!revision);
}, },