Skip to content

Commit

Permalink
Merge pull request #40 from kudashevs/os_check_refinement
Browse files Browse the repository at this point in the history
Refine the Windows OS check
  • Loading branch information
freekmurze authored Feb 16, 2022
2 parents 50e61e0 + 11eff5f commit 617c41d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Config/DefaultConfigFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function getConfigFilePath(): string

protected function findHomeDirectory(): ?string
{
if (str_starts_with(PHP_OS, 'WIN')) {
if ($this->isWindows()) {
if (empty($_SERVER['HOMEDRIVE']) || empty($_SERVER['HOMEPATH'])) {
return null;
}
Expand All @@ -33,4 +33,9 @@ protected function findHomeDirectory(): ?string

return null;
}

private function isWindows(): bool
{
return str_starts_with(strtoupper(PHP_OS), 'WIN');
}
}

0 comments on commit 617c41d

Please sign in to comment.