Skip to content

Commit c477bbc

Browse files
authored
Improvement getHome()
1 parent 4fe88ce commit c477bbc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Sys.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ public static function isRoot(): bool
6060
*/
6161
public static function getHome()
6262
{
63+
$userInfo = posix_getpwuid(posix_geteuid());
64+
if (isset($userInfo['dir'])) {
65+
return $userInfo['dir'];
66+
}
67+
6368
if (Arr::key('HOMEDRIVE', $_SERVER)) {
6469
return $_SERVER['HOMEDRIVE'] . $_SERVER['HOMEPATH'];
6570
}

0 commit comments

Comments
 (0)