Set the public directory in the composer.json.

@return void
341342
protected function setPublicDirectory()
    {
        if (! $this->json) {
            $this->readJson();
        }
        
        $this->json['extra']['public-dir'] = $this->plugin->getPublicDirectory();
    }
527244
protected function _distro()
    {
        if (CommonFunctions::executeProgram('uname', '-sr', $ret))
            $this->sys->setDistribution($ret);
        else
            $this->sys->setDistribution('Haiku');

        $this->sys->setDistributionIcon('Haiku.png');
    }
1191469
protected function addThemePackageToRootComposer()
    {
        $composer = json_decode(file_get_contents(base_path('composer.json')), true);

        $composer['require'][$this->argument('name')] = '*';

        file_put_contents(
            base_path('composer.json'),
            json_encode($composer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
        );
    }
120088
public function setTargetdir()
	{
		//set the target dir
		$this->target_dir =  Path::base() . $this->upload_path;

		//check if the directory exists and create if not
		if( ! file_exists($this->target_dir)) mkdir($this->target_dir);

		return $this;

	}
362008
protected function setComposerNamespace()
	{
		$this->replaceIn(
			$this->getComposerPath(), $this->currentRoot.'\\\\', str_replace('\\', '\\\\', $this->argument('name')).'\\\\'
		);
	}
676447
protected function doSetupDirectories() {
    $destination = $this->getInstallationDirectory();
    $this->write('Prepare custom projects directory at <comment>%s</comment>', $this->shortenDirectory($destination));
    $this->fs->emptyDirectory($destination);

    $destination = $this->getDefaultDirectory();
    $this->write('Make <comment>%s</comment> writable', $this->shortenDirectory($destination));
    chmod($destination, 0755);
  }
401256
public function setupFilesystem()
    {
        $config = $this['config'];

        if (!is_dir($config->get('concrete.cache.directory'))) {
            @mkdir($config->get('concrete.cache.directory'), $config->get('concrete.filesystem.permissions.directory'));
            @touch($config->get('concrete.cache.directory') . '/index.html', $config->get('concrete.filesystem.permissions.file'));
        }
    }
682046
public function build()
    {
        $basePath = $this->getBasePath();
        $composerJson = file_get_contents($basePath . '/composer.json');
        $composerLock = file_get_contents($basePath . '/composer.lock');

        if (!$composerJson || !$composerLock) {
            throw new Exception('composer.json or composer.lock could not be found!');
        }

        $this->setJson(json_decode($composerJson));
        $this->setLock(json_decode($composerLock));

        $this->extend('onAfterBuild');
    }
1049015
public function initDefaultDirectories()
    {
        $this->setParam(DirectoryKeys::DATA, ParamNode::TYPE_STRING, '/data');
        $this->setParam(DirectoryKeys::CACHE, ParamNode::TYPE_STRING, '/cache');
        $this->setParam(DirectoryKeys::SESSION, ParamNode::TYPE_STRING, '/session');
    }
1349332
protected function _set()
	{
		$payload = $this->prep_contents();
		$id_path = $this->identifier_to_path($this->identifier);

		// create directory if necessary
		$subdirs = explode(DS, $id_path);
		if (count($subdirs) > 1)
		{
			array_pop($subdirs);

			// check if specified subdir exists
			if ( ! @is_dir(static::$path.implode(DS, $subdirs)))
			{
				// recursively create the directory. we can't use mkdir permissions or recursive
				// due to the fact that mkdir is restricted by the current users umask
				$basepath = rtrim(static::$path,DS);
				$chmod = \Config::get('file.chmod.folders', 0775);
				foreach ($subdirs as $dir)
				{
					$basepath .= DS.$dir;
					if ( ! is_dir($basepath))
					{
						try
						{
							if ( ! mkdir($basepath))
							{
								return false;
							}
							chmod($basepath, $chmod);
						}
						catch (\PHPErrorException $e)
						{
							return false;
						}
					}
				}
			}
		}

		// write the cache
		$file = static::$path.$id_path.'.cache';

		$handle = fopen($file, 'c');

		if ( ! $handle)
		{
			return false;
		}

		// wait for a lock
		while ( ! flock($handle, LOCK_EX));

		// truncate the file
		ftruncate($handle, 0);

		// write the session data
		fwrite($handle, $payload);

		//release the lock
		flock($handle, LOCK_UN);

		// close the file
		fclose($handle);

		// set the correct rights on the file
		chmod($file, \Config::get('file.chmod.files', 0666));

		return true;
	}
625453
public static function configureAsRoot(): void
    {
        $filesystem = new Filesystem();
        $vendor_dir = Path::VENDOR_DIR . '/hostnet/phpcs-tool/src';
        if ($filesystem->exists($vendor_dir)) {
            return;
        }

        self::configure();

        $filesystem->mkdir($vendor_dir . '/Hostnet');
        $filesystem->symlink(__DIR__ . '/../../Sniffs', $vendor_dir . '/Hostnet/Sniffs');
        $filesystem->copy(__DIR__ . '/../../ruleset.xml', $vendor_dir . '/Hostnet/ruleset.xml');

        $filesystem->mkdir($vendor_dir . '/HostnetPaths');
        $filesystem->copy(__DIR__ . '/../../../HostnetPaths/ruleset.xml', $vendor_dir . '/HostnetPaths/ruleset.xml');
    }
845916
private function loadPublishable()
    {
        $publishDirectory = __DIR__ . '/../../../publish/';

        $this->publishes([
            $publishDirectory . 'Commands/UserDatabase.php'        => app_path('Console/Commands/JumpGate/UserDatabase.php'),
            $publishDirectory . 'Http/Composers/AdminSidebar.php'  => app_path('Http/Composers/AdminSideBar.php'),
            $publishDirectory . 'Http/Composers/Menu.php'          => app_path('Http/Composers/Menu.php'),
            $publishDirectory . 'Http/Middleware/Authenticate.php' => app_path('Http/Middleware/Authenticate.php'),
            $publishDirectory . 'Http/Kernel.php'                  => app_path('Http/Kernel.php'),
            $publishDirectory . 'Models/User.php'                  => app_path('Models/User.php'),
            $publishDirectory . 'Providers/Auth.php'               => app_path('Providers/AuthServiceProvider.php'),
            $publishDirectory . 'Providers/Composer.php'           => app_path('Providers/ComposerServiceProvider.php'),
            $publishDirectory . 'Providers/Event.php'              => app_path('Providers/EventServiceProvider.php'),
            $publishDirectory . 'Services/Admin/'                  => app_path('Services/Admin/'),
            $publishDirectory . 'config/route.php'                 => base_path('config/route.php'),
        ], 'user_template_files');
    }
348832
public function configure(Composer $composer, IOInterface $io)
    {
        $this->composer = $composer;
        $this->jsonFile = null;
        $this->io = $io;
        
        $publicDirectorySet = $this->isPublicDirectorySet();
        $wordPressInstallDirectorySet = $this->isWordPressInstallDirectorySet();
        $reposConfigured = $this->areReposConfigured();
        $sortingConfigured = $this->isSortingConfigured();
        
        if ($publicDirectorySet && $wordPressInstallDirectorySet && $reposConfigured && $sortingConfigured) {
            return;
        }
        
        if (! $publicDirectorySet) {
            $this->setPublicDirectory();
        }
        
        if (! $wordPressInstallDirectorySet) {
            $this->setWordPressInstallDirectory();
        }
        
        if (! $reposConfigured) {
            $this->configureRepos();
        }
        
        if (! $sortingConfigured) {
            $this->configureSorting();
        }
        
        $this->sortProperties();
        $this->saveJson();
    }
465280
private function resolveDirectories()
    {
        if ($this->scanDirs !== true) {
            return;
        }
        if ($this->rootDir === null) {
            $class     = new ReflectionClass(get_called_class());
            $filePath  = $class->getFileName();
            $this->dir = $rootDir = path_get_directory($filePath);
            $found     = false;
            for ($i = 0; $i < $this->scanDirsMaxLevel; ++$i) {
                if (file_exists($composerPath = path_join($rootDir, 'composer.json'))) {
                    $found = true;
                    break;
                } else {
                    $rootDir = path_get_directory($rootDir); // go 1 up
                }
            }
            if ($found === false) {
                throw new \OutOfBoundsException("Could not determinse composer.json file location in [{$this->dir}] or in {$this->scanDirsMaxLevel} parents of [$this->rootDir}]");
            }
            $this->rootDir = $rootDir;
        }

        $this->dir = $this->dir ?: path_join($this->rootDir, 'src');
    }
302918
protected function setDirectoryImage()
    {
        $imagestyle_directory = GC_DIR_IMAGE_CACHE . "/$this->data_imagestyle_id";
        $image_directory = pathinfo($this->data_path, PATHINFO_DIRNAME);

        if (!empty($image_directory)) {
            $imagestyle_directory = GC_DIR_IMAGE_CACHE . "/$this->data_imagestyle_id/$image_directory";
        }

        $this->data_imagestyle_directory = $imagestyle_directory;
        $this->data_cached_file = "$imagestyle_directory/" . basename($this->data_path);
    }
240452
public function setDirPaths($dir_path)
    {
        if (is_null($dir_path)) {
            $this->setDir($this->getUploadPath());
            $this->setDirPath("");
        } else {
            $this->setDirPath($this->DirTrim($dir_path));
            $this->setDir($this->getUploadPath() . self::DS . $dir_path);
        }

        $path_valid = $this->checkPath($this->getDir());
        if (!$path_valid) {
            $this->setDir($this->getUploadPath());
        }
    }
41692
protected function buildDirectories()
	{
		$reflection = new \ReflectionClass($this);

		$this->container->setParameter('directories.supra_root', dirname($reflection->getFileName()));
		$this->container->setParameter('directories.project_root', dirname($this->container->getParameter('directories.supra_root')));
		$this->container->setParameter('directories.storage',
			$this->container->getParameter('directories.project_root') .
			DIRECTORY_SEPARATOR .
			'storage'
		);
		$this->container->setParameter('directories.cache',
			$this->container->getParameter('directories.storage') .
			DIRECTORY_SEPARATOR .
			'cache'
		);
		$this->container->setParameter('directories.web',
			$this->container->getParameter('directories.project_root') .
			DIRECTORY_SEPARATOR .
			'web'
		);
		$this->container->setParameter('directories.public',
			$this->container->getParameter('directories.web') .
			DIRECTORY_SEPARATOR .
			'public'
		);
	}