Skip to content

Commit

Permalink
Merge pull request #39 from Lukasss93/fix-missing-lang-folder
Browse files Browse the repository at this point in the history
Fix missing lang folder
Lukasss93 authored Mar 15, 2024

Verified

This commit was signed with the committer’s verified signature.
camdencheek Camden Cheek
2 parents d652229 + d6d2195 commit d749ee4
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Console/LarexInitCommand.php
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ public function handle(): int
return 1;
}

File::put(csv_path(), Utils::getStub($stub));
Utils::filePut(csv_path(), Utils::getStub($stub));

$this->info(csv_path(true).' created successfully.');

9 changes: 9 additions & 0 deletions src/Support/Utils.php
Original file line number Diff line number Diff line change
@@ -306,4 +306,13 @@ public static function putJson(string $path, $data): void
JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
File::put($path, Str::finish($content, "\n"));
}

public static function filePut(string $path, string $content): void
{
if (!File::exists(dirname($path))) {
File::makeDirectory(dirname($path), 0755, true, true);
}

File::put($path, $content);
}
}
7 changes: 6 additions & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
@@ -42,6 +42,11 @@
File::delete($item);
}
}

//delete lang folder
if (file_exists(lang_path())) {
@rmdir(lang_path());
}
})
->in(__DIR__);

@@ -81,7 +86,7 @@ function getTestStub(string $name, $eol = "\n"): string
function initFromStub(string $stub, string $file = null): string
{
$filePath = Utils::normalizeDS($file ?? csv_path());
File::put($filePath, getTestStub($stub));
Utils::filePut($filePath, getTestStub($stub));

return $filePath;
}

0 comments on commit d749ee4

Please sign in to comment.