Skip to content

Commit

Permalink
add method to ensure a directory exists
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 27, 2020
1 parent b5f3d22 commit 8a8eed4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Illuminate/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,21 @@ public function directories($directory)
return $directories;
}

/**
* Ensure a directory exists.
*
* @param string $path
* @param int $mode
* @param bool $recursive
* @return void
*/
public function ensureDirectoryExists($path, $mode = 0755, $recursive = true)
{
if (! $this->isDirectory($path)) {
$this->makeDirectory($path, $mode, $recursive);
}
}

/**
* Create a directory.
*
Expand Down

0 comments on commit 8a8eed4

Please sign in to comment.