1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-06 16:50:09 +01:00

Pre-create the parent .config dir if needed

On a fresh OSX install, the ~/.config/ dir doesn't always exist. This checks and creates it if needed.
This commit is contained in:
Chris Brown
2018-11-11 16:44:52 -05:00
committed by Matt Stauffer
parent 25d6e47eb1
commit 027812c25f
2 changed files with 3 additions and 0 deletions

View File

@@ -41,6 +41,8 @@ function install()
*/ */
function createConfigurationDirectory() function createConfigurationDirectory()
{ {
$this->files->ensureDirExists(preg_replace('~/valet$~', '', VALET_HOME_PATH), user());
$oldPath = posix_getpwuid(fileowner(__FILE__))['dir'].'/.valet'; $oldPath = posix_getpwuid(fileowner(__FILE__))['dir'].'/.valet';
if ($this->files->isDir($oldPath)) { if ($this->files->isDir($oldPath)) {

View File

@@ -28,6 +28,7 @@ public function tearDown()
public function test_configuration_directory_is_created_if_it_doesnt_exist() public function test_configuration_directory_is_created_if_it_doesnt_exist()
{ {
$files = Mockery::mock(Filesystem::class.'[ensureDirExists,isDir]'); $files = Mockery::mock(Filesystem::class.'[ensureDirExists,isDir]');
$files->shouldReceive('ensureDirExists')->once()->with(preg_replace('~/valet$~', '', VALET_HOME_PATH), user());
$files->shouldReceive('ensureDirExists')->once()->with(VALET_HOME_PATH, user()); $files->shouldReceive('ensureDirExists')->once()->with(VALET_HOME_PATH, user());
$files->shouldReceive('isDir')->once(); $files->shouldReceive('isDir')->once();
swap(Filesystem::class, $files); swap(Filesystem::class, $files);