Skip to content

Commit a184d96

Browse files
authored
Merge pull request #72 from dsteinman/r0.8-electron-audio-warning
add warning to electron example if the audio path doesn't exist
2 parents 3fc7a7f + 1968c4e commit a184d96

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

electron/Readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ npm run rebuild
1414
Download and extract audio files to `/public` directory
1515

1616
```
17-
wget https://github.com/mozilla/DeepSpeech/releases/download/v0.7.0/audio-0.7.0.tar.gz
18-
tar xfvz audio-0.7.0.tar.gz -C ./public/
17+
wget https://github.com/mozilla/DeepSpeech/releases/download/v0.8.0/audio-0.8.0.tar.gz
18+
tar xfvz audio-0.8.0.tar.gz -C ./public/
1919
```
2020

2121
(Optional) Download or softlink DeepSpeech 0.8.0 model files to the root of the project:

electron/public/create-window.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,20 @@ function createWindow(model) {
6868
return new Promise(function (resolve, reject) {
6969
try {
7070
let audioPath = path.resolve(__dirname, 'audio');
71-
fs.readdir(audioPath, function (err, files) {
72-
files = files.filter(function (file) {
73-
return file.endsWith('.wav');
74-
});
75-
resolve(files);
71+
fs.exists(audioPath, function(exists) {
72+
if (exists) {
73+
fs.readdir(audioPath, function (err, files) {
74+
files = files.filter(function (file) {
75+
return file.endsWith('.wav');
76+
});
77+
resolve(files);
78+
});
79+
}
80+
else {
81+
console.log('audio files path does not exist: ', audioPath);
82+
console.log('See Readme.md');
83+
process.exit();
84+
}
7685
});
7786
} catch (e) {
7887
reject(e.toString())

0 commit comments

Comments
 (0)