Skip to content

Commit

Permalink
[Phing] Simplified os family condition (#1308)
Browse files Browse the repository at this point in the history
  • Loading branch information
siad007 authored Apr 11, 2020
1 parent 844995a commit 62752af
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions classes/phing/Phing.php
Original file line number Diff line number Diff line change
Expand Up @@ -1573,27 +1573,19 @@ private static function setSystemConstants()
// used by Fileself::getFileSystem to instantiate the correct
// abstraction layer

switch (strtoupper(PHP_OS)) {
case 'WINNT':
case 'WIN32':
self::setProperty('host.fstype', 'WINDOWS');
break;
default:
self::setProperty('host.fstype', 'UNIX');
break;
if (PHP_OS_FAMILY === 'Windows') {
self::setProperty('host.fstype', 'WINDOWS');
self::setProperty('user.home', getenv('HOMEDRIVE') . getenv('HOMEPATH'));
} else {
self::setProperty('host.fstype', 'UNIX');
self::setProperty('user.home', getenv('HOME'));
}

self::setProperty(self::PHP_INTERPRETER, PHP_BINARY);
self::setProperty('file.separator', FileUtils::$separator);
self::setProperty('line.separator', PHP_EOL);
self::setProperty('path.separator', FileUtils::$pathSeparator);
self::setProperty(self::PHP_VERSION, PHP_VERSION);
self::setProperty('php.tmpdir', sys_get_temp_dir());
if (stripos(PHP_OS, 'WIN') !== 0) {
self::setProperty('user.home', getenv('HOME'));
} else {
self::setProperty('user.home', getenv('HOMEDRIVE') . getenv('HOMEPATH'));
}
self::setProperty('application.startdir', getcwd());
self::setProperty('phing.startTime', gmdate('D, d M Y H:i:s', time()) . ' GMT');

Expand Down

0 comments on commit 62752af

Please sign in to comment.