Skip to content

Commit

Permalink
Merge pull request #1 from hyperlinkgroup/lang_path
Browse files Browse the repository at this point in the history
Change base_path('lang') to lang_path()
  • Loading branch information
Katalam authored Mar 5, 2024
2 parents 2044163 + 6a44817 commit 03e8b76
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Linguist.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ protected function ensureDirectoriesExist(): void
$paths = collect();

$this->languages->each(function ($language) use (&$paths) {
$paths->push(base_path("lang/$language"));
$paths->push(lang_path($language));
});

$paths->push(storage_path($this->getTemporaryDirectory()));
Expand Down Expand Up @@ -228,7 +228,7 @@ public function moveFiles(): self

foreach ($files as $file) {
$language = $file->getFilenameWithoutExtension();
$destination = base_path("lang/$language/$this->project.json");
$destination = lang_path("$language/$this->project.json");

File::move($file, $destination);
}
Expand Down
12 changes: 6 additions & 6 deletions tests/LinguistTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@

function cleanUp(): void
{
if (File::exists(base_path('lang'))) {
collect(File::files(base_path('lang')))->each(function (SplFileInfo $file) {
if (File::exists(lang_path())) {
collect(File::files(lang_path()))->each(function (SplFileInfo $file) {
File::delete($file->getPathname());
});

File::deleteDirectory(base_path('lang'));
File::deleteDirectory(lang_path());
}

if (File::exists(storage_path('tmp/translations'))) {
Expand Down Expand Up @@ -101,7 +101,7 @@ function cleanUp(): void
->createDirectories();

$languages->each(function (string $language) {
assertFileExists(base_path("lang/$language"));
assertFileExists(lang_path("$language"));
});

assertFileExists(storage_path(config('linguist.temporary_directory')));
Expand Down Expand Up @@ -156,7 +156,7 @@ function cleanUp(): void
->moveFiles();

$languages->each(function (string $language) {
assertFileExists(base_path("lang/$language/project.json"));
assertFileExists(lang_path("$language/project.json"));
});

assertFileDoesNotExist(storage_path(config('linguist.temporary_directory')));
Expand Down Expand Up @@ -192,7 +192,7 @@ function cleanUp(): void
Linguist::start()->handle();

$languages->each(function (string $language) {
assertFileExists(base_path("lang/$language/project.json"));
assertFileExists(lang_path("$language/project.json"));
});

assertFileDoesNotExist(storage_path(config('linguist.temporary_directory')));
Expand Down

0 comments on commit 03e8b76

Please sign in to comment.