public static function getHomedir()
    {
        $home = (string) getenv('GUSH_HOME');

        if ('' === $home) {
            // Try APPDATA first, HOME on Windows is only defined in the Git terminal
            // but when you run Gush using cmd it will not able to find the config-dir
            if (getenv('APPDATA')) {
                $home = strtr(getenv('APPDATA'), '\\', '/').'/Gush';
            } elseif (getenv('HOME')) {
                $home = (string) getenv('HOME').'/.gush';
            }
        }

        if ('' === $home) {
            throw new \RuntimeException(
                'Unable to determine the home directory of your Gush config.'."\n".
                'Neither the "GUSH_HOME", "HOME" or "APPDATA" (Windows only) environment variables were set.'."\n".
                'Set the "GUSH_HOME" environment variable for Gush to run correctly.'
            );
        }

        $fs = self::getFilesystem();

        if (!$fs->exists($home)) {
            $fs->mkdir($home, 0744);
        }

        return $home;
    }
public static function getHomedir()
    {
        $home = (string) getenv('GUSH_HOME');

        if ('' === $home) {
            // Try APPDATA first, HOME on Windows is only defined in the Git terminal
            // but when you run Gush using cmd it will not able to find the config-dir
            if (getenv('APPDATA')) {
                $home = strtr(getenv('APPDATA'), '\\', '/').'/Gush';
            } elseif (getenv('HOME')) {
                $home = (string) getenv('HOME').'/.gush';
            }
        }

        if ('' === $home) {
            throw new \RuntimeException(
                'Unable to determine the home directory of your Gush config.'."\n".
                'Neither the "GUSH_HOME", "HOME" or "APPDATA" (Windows only) environment variables were set.'."\n".
                'Set the "GUSH_HOME" environment variable for Gush to run correctly.'
            );
        }

        $fs = self::getFilesystem();

        if (!$fs->exists($home)) {
            $fs->mkdir($home, 0744);
        }

        return $home;
    }
public static function getHomedir ( ) { $ home = ( string ) getenv ( 'GUSH_HOME' ) ; if ( '' === $ home ) { // Try APPDATA first, HOME on Windows is only defined in the Git terminal // but when you run Gush using cmd it will not able to find the config-dir if ( getenv ( 'APPDATA' ) ) { $ home = strtr ( getenv ( 'APPDATA' ) , '\\' , '/' ) . '/Gush' ; } elseif ( getenv ( 'HOME' ) ) { $ home = ( string ) getenv ( 'HOME' ) . '/.gush' ; } } if ( '' === $ home ) { throw new \ RuntimeException ( 'Unable to determine the home directory of your Gush config.' . "\n" . 'Neither the "GUSH_HOME", "HOME" or "APPDATA" (Windows only) environment variables were set.' . "\n" . 'Set the "GUSH_HOME" environment variable for Gush to run correctly.' ) ; } $ fs = self :: getFilesystem ( ) ; if ( ! $ fs -> exists ( $ home ) ) { $ fs -> mkdir ( $ home , 0744 ) ; } return $ home ; }
Get the home directory of Gush.

This checks multiple environment variables:
* GUSH_HOME
* APPDATA (used by Windows)
* HOME

@throws \RuntimeException when no environment variable was found
@throws IOException       the missing home-directory cannot be created

@return string
Get the home directory of Gush .