getHomeDirectory() 공개 정적인 메소드

Supported operating systems: - UNIX - Windows8 and upper If your operation system or environment isn't supported, an exception is thrown. The result is a canonical path.
부터: 2.1 Added method.
public static getHomeDirectory ( ) : string
리턴 string The canonical home directory
예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function getConfigTreeBuilder()
 {
     $treeBuilder = new TreeBuilder();
     $rootNode = $treeBuilder->root('nanando');
     $rootNode->children()->scalarNode('name')->defaultValue('nanbando')->end()->arrayNode('application')->addDefaultsIfNotSet()->children()->scalarNode('name')->defaultNull()->end()->scalarNode('version')->defaultNull()->end()->arrayNode('options')->prototype('scalar')->end()->end()->end()->end()->scalarNode('temp')->defaultValue(sys_get_temp_dir())->end()->arrayNode('backup')->useAttributeAsKey('name')->prototype('array')->children()->scalarNode('plugin')->end()->arrayNode('parameter')->prototype('variable')->end()->end()->end()->end()->end()->arrayNode('storage')->addDefaultsIfNotSet()->children()->scalarNode('local_directory')->defaultValue(Path::join([Path::getHomeDirectory(), 'nanbando']))->end()->scalarNode('remote_service')->end()->end()->end()->arrayNode('require')->prototype('variable')->end()->end()->arrayNode('presets')->prototype('array')->children()->scalarNode('application')->end()->scalarNode('version')->end()->arrayNode('options')->prototype('scalar')->end()->end()->arrayNode('backup')->prototype('array')->children()->scalarNode('plugin')->end()->arrayNode('parameter')->prototype('variable')->end()->end()->end()->end()->end()->end()->end()->end()->end();
     return $treeBuilder;
 }
예제 #2
0
 public function testGetHomeDirectoryForWindows()
 {
     putenv('HOME=');
     putenv('HOMEDRIVE=C:');
     putenv('HOMEPATH=/users/webmozart');
     $this->assertEquals('C:/users/webmozart', Path::getHomeDirectory());
 }
예제 #3
0
파일: nanbando.php 프로젝트: nanbando/core
<?php

set_time_limit(0);
define('NANBANDO_DIR', getenv('NANBANDO_DIR') ?: '.nanbando');
use Dflydev\EmbeddedComposer\Core\EmbeddedComposerBuilder;
use Nanbando\Application\Application;
use Nanbando\Application\Kernel;
use Puli\Discovery\JsonDiscovery;
use Symfony\Component\Console\Input\ArgvInput;
use Webmozart\PathUtil\Path;
$input = new ArgvInput();
if ($projectDir = $input->getParameterOption('--root-dir')) {
    if (false !== strpos($projectDir, '~') && function_exists('posix_getuid')) {
        $info = posix_getpwuid(posix_getuid());
        $projectDir = str_replace('~', $info['dir'], $projectDir);
    }
    if (!is_dir($projectDir)) {
        throw new \InvalidArgumentException(sprintf('Specified project directory %s does not exist', $projectDir));
    }
    chdir($projectDir);
}
$discovery = new JsonDiscovery(Path::join([getcwd(), NANBANDO_DIR, '.puli', 'bindings.json']));
$embeddedComposerBuilder = new EmbeddedComposerBuilder($classLoader);
$embeddedComposer = $embeddedComposerBuilder->setComposerFilename('nanbando.json')->setVendorDirectory(NANBANDO_DIR)->build();
$embeddedComposer->processAdditionalAutoloads();
$kernel = new Kernel('prod', true, Path::getHomeDirectory(), $discovery);
$kernel->boot();
$input = $kernel->getContainer()->get('input');
$output = $kernel->getContainer()->get('output');
$application = new Application($kernel, $embeddedComposer);
$application->run($input, $output);