N98\Util\OperatingSystem::getHomeDir PHP Method

getHomeDir() public static method

Home directory of the current user
public static getHomeDir ( ) : string | false
return string | false false in case there is no environment variable related to the home directory
    public static function getHomeDir()
    {
        if (self::isWindows()) {
            return getenv('USERPROFILE');
        }
        return getenv('HOME');
    }

Usage Example

コード例 #1
0
 /**
  * @param array  $scriptFolders
  * @param string $magentoRootFolder
  */
 public function __construct(array $scriptFolders, $magentoRootFolder = null)
 {
     $this->_magentoRootFolder = $magentoRootFolder;
     if (OperatingSystem::isWindows()) {
         $this->_homeScriptFolder = OperatingSystem::getHomeDir() . '/n98-magerun2/scripts';
     } else {
         $this->_homeScriptFolder = OperatingSystem::getHomeDir() . '/.n98-magerun2/scripts';
     }
     $this->_scriptFolders = $scriptFolders;
     $this->_scriptFolders[] = $this->_homeScriptFolder;
     foreach ($this->_scriptFolders as $key => $scriptFolder) {
         if (!is_dir($scriptFolder)) {
             unset($this->_scriptFolders[$key]);
         }
     }
     if (count($this->_scriptFolders)) {
         $this->findScripts();
     }
 }
All Usage Examples Of N98\Util\OperatingSystem::getHomeDir