diff --git a/src/Linguist.php b/src/Linguist.php index 43fee65..6ede666 100755 --- a/src/Linguist.php +++ b/src/Linguist.php @@ -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())); @@ -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); } diff --git a/tests/LinguistTest.php b/tests/LinguistTest.php index 4cd88ae..6862d85 100644 --- a/tests/LinguistTest.php +++ b/tests/LinguistTest.php @@ -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'))) { @@ -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'))); @@ -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'))); @@ -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')));