Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change base_path('lang') to lang_path() #1

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading