Make FileSystem::createDirectory() error handling similar to FileSystem::createFile()

This commit is contained in:
Giuseppe Criscione 2020-11-27 15:46:09 +01:00
parent 43b9836b3c
commit b29350e801

View File

@ -447,8 +447,10 @@ class FileSystem
*/
public static function createDirectory(string $directory, bool $recursive = false): bool
{
static::assertExists($directory, false);
return @mkdir($directory, 0777, $recursive);
if (@mkdir($directory, 0777, $recursive)) {
return true;
}
throw new RuntimeException('Cannot create directory ' . $directory);
}
/**