Check if the sounds directory exists

This commit is contained in:
markjcrane 2023-05-16 00:36:27 -06:00
parent 6fa40778f7
commit 3cf0334686
1 changed files with 5 additions and 3 deletions

View File

@ -66,9 +66,11 @@ class file {
if (!isset($voice)) { $voice = 'callie'; }
//set the variables
$dir = $_SESSION['switch']['sounds']['dir'].'/'.$language.'/'.$dialect.'/'.$voice;
$rate = '8000';
$files = $this->glob($dir.'/*/'.$rate, true);
if (!empty($_SESSION['switch']['sounds']['dir']) && file_exists($_SESSION['switch']['sounds']['dir'])) {
$dir = $_SESSION['switch']['sounds']['dir'].'/'.$language.'/'.$dialect.'/'.$voice;
$rate = '8000';
$files = $this->glob($dir.'/*/'.$rate, true);
}
//loop through the languages
if (!empty($files)) {