Skip to content
This repository has been archived by the owner on Aug 18, 2018. It is now read-only.

Commit

Permalink
Check if the file doesn't exists before creating it.
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperFranz committed Mar 4, 2016
1 parent 4ea4992 commit 707e80d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Xinax/LaravelGettext/FileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,26 @@ public function addLocale($localePath, $locale)
"LC_MESSAGES"
);

$this->createDirectory($localePath);
if (!file_exists($localePath)) {
$this->createDirectory($localePath);
}

if ( $this->configuration->getCustomLocale() ) {
$data[1] = 'C';

$gettextPath = implode($data, DIRECTORY_SEPARATOR);
$this->createDirectory($gettextPath);
if (!file_exists($gettextPath)) {
$this->createDirectory($gettextPath);
}

$data[2] = 'LC_MESSAGES';
}

$gettextPath = implode($data, DIRECTORY_SEPARATOR);
$this->createDirectory($gettextPath);
if (!file_exists($gettextPath)) {
$this->createDirectory($gettextPath);
}


// File generation for each domain
foreach ($this->configuration->getAllDomains() as $domain) {
Expand Down Expand Up @@ -434,8 +441,9 @@ public function checkDirectoryStructure($checkLocales = false)
public function generateLocales()
{
// Application base path
$this->createDirectory($this->getDomainPath());

if (!file_exists($this->getDomainPath())) {
$this->createDirectory($this->getDomainPath());
}
$localePaths = [];

// Locale directories
Expand Down

0 comments on commit 707e80d

Please sign in to comment.