Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit 7bc24ba

Browse files
authored
Make DownloadAssetsCommand work for Windows too (#10)
1 parent 97e3d44 commit 7bc24ba

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/DownloadAssetsCommand.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ public function handle()
3232
);
3333
}
3434

35-
protected function fileForceContents(string $path, string $contents)
35+
protected function fileForceContents(string $filePath, string $contents)
3636
{
37-
$parts = explode('/', $path);
38-
$file = array_pop($parts);
39-
$path = '';
40-
foreach ($parts as $part) {
41-
if (!is_dir($path .= "/$part")) {
42-
mkdir($path);
43-
}
37+
// Ensure the directory exists
38+
$directory = dirname($filePath);
39+
if(! is_dir($directory)){
40+
mkdir($directory, 0777, true);
4441
}
45-
file_put_contents("$path/$file", $contents);
42+
43+
file_put_contents(
44+
$filePath,
45+
$contents
46+
);
4647
}
4748
}

0 commit comments

Comments
 (0)