Skip to content

Commit b4eea54

Browse files
committed
up: update a method lgoic
1 parent d787f48 commit b4eea54

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/File.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use function function_exists;
2828
use function in_array;
2929
use function is_array;
30+
use function is_dir;
3031
use function is_file;
3132
use function is_string;
3233
use function stream_get_contents;
@@ -282,6 +283,10 @@ public static function save(string $filename, $data, int $flags = 0, $context =
282283
*/
283284
public static function mkdirSave(string $filename, $data, int $flags = 0, $context = null): int
284285
{
286+
if (!is_dir($dir = dirname($filename))) {
287+
self::mkdir($dir);
288+
}
289+
285290
return self::putContents($filename, $data, $flags, $context);
286291
}
287292

0 commit comments

Comments
 (0)