/**
* Checks the required directory
* Optionally checks each local directory, if $checkLocales is true
*
* @param bool|false $checkLocales
* @return bool
* @throws DirectoryNotFoundException
*/
public function checkDirectoryStructure($checkLocales = false)
{
// Application base path
if (!file_exists($this->basePath)) {
throw new Exceptions\DirectoryNotFoundException(sprintf('Missing root path directory: %s, check the \'base-path\' key in your configuration.', $this->basePath));
}
// Domain path
$domainPath = $this->getDomainPath();
// Translation files domain path
if (!file_exists($domainPath)) {
throw new Exceptions\DirectoryNotFoundException(sprintf('Missing base required directory: %s, remember to run \'artisan gettext:create\' the first time', $domainPath));
}
if (!$checkLocales) {
return true;
}
foreach ($this->configuration->getSupportedLocales() as $locale) {
// Default locale is not needed
if ($locale == $this->configuration->getLocale()) {
continue;
}
$localePath = $this->getDomainPath($locale);
if (!file_exists($localePath)) {
throw new Exceptions\DirectoryNotFoundException(sprintf('Missing locale required directory: %s, maybe you forgot to run \'artisan gettext:update\'', $locale));
}
}
return true;
}