Setup root directory.

@param string $dir
@throws Exception
515668
public function setRoot($dir)
    {
        if (!is_dir($dir)) {
            throw new Exception(sprintf('Not found directory: %s', $dir));
        }

        $this->root = $this->cleanPath($dir);
    }
610173
public function setProxyDir(string $directory) : void
    {
        $this->getProxyManagerConfiguration()->setProxiesTargetDir($directory);
        $this->setAutoGenerateProxyClasses(ProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS);
    }
990209
protected function detectDir($dir)
    {
        if ($this->autoMkdir && !file_exists($dir)) {
            mkdir($dir, $this->dirMode, true);
        }
    }
1151536
public function setProxyDir(string $dir) : void
    {
        $this->getProxyManagerConfiguration()->setProxiesTargetDir($dir);

        // Recreate proxy generator to ensure its path was updated
        if ($this->autoGenerateProxyClasses !== self::AUTOGENERATE_FILE_NOT_EXISTS) {
            return;
        }

        $this->setAutoGenerateProxyClasses($this->autoGenerateProxyClasses);
    }
937757
public function setBasedir($dir)
    {
        if ($dir instanceof PhingFile) {
            $dir = $dir->getAbsolutePath();
        }

        $dir = $this->fileUtils->normalize($dir);
        $dir = FileSystem::getFileSystem()->canonicalize($dir);

        $dir = new PhingFile((string) $dir);
        if (!$dir->exists()) {
            throw new BuildException("Basedir " . $dir->getAbsolutePath() . " does not exist");
        }
        if (!$dir->isDirectory()) {
            throw new BuildException("Basedir " . $dir->getAbsolutePath() . " is not a directory");
        }
        $this->basedir = $dir;
        $this->setPropertyInternal("project.basedir", $this->basedir->getAbsolutePath());
        $this->log("Project base dir set to: " . $this->basedir->getPath(), Project::MSG_VERBOSE);

        // [HL] added this so that ./ files resolve correctly.  This may be a mistake ... or may be in wrong place.
        chdir($dir->getAbsolutePath());
    }
811822
public function setDirectory($directory)
    {
        $this->directory = $directory . DIRECTORY_SEPARATOR . $this->id;
        if (file_exists($this->directory) === false) {
            mkdir($this->directory, $this->fileMode, true);
        }
    }
593919
public function rmdir($dir) {
		$this->connectIfNeeded();
		$this->handle->rmdir($dir);
		$this->onFolderDeleted(new Event(['sender' => $this, 'data' => $dir]));
	}
520790
public function rmdirR($dir)
    {
        $finder = $this->finder->create();
        $files = $finder->notRecursive()->find($dir);
        foreach ($files as $file) {
            if (! $file->isExists()) continue;

            if ($file->isDir()) {
                $this->rmdirR("{$file}/*");
                if ($file->isWritable()) {
                    rmdir($file);
                } else {
                    throw new Exception("Can not delete this directory. -> {$file}");
                }
            } else {
                if ($file->isWritable()) {
                    unlink($file);
                } else {
                    throw new Exception("Can not delete this file. -> {$file}");
                }
            }
        }
    }
1308391
protected function addDir($dir)
    {
        // Add any additional directories to the top of the array
        // so that the user can override art
        array_unshift($this->art_dirs, rtrim($dir, '/'));

        // Keep the array clean
        $this->art_dirs = array_unique($this->art_dirs);
        $this->art_dirs = array_filter($this->art_dirs);
        $this->art_dirs = array_values($this->art_dirs);
    }
325158
protected function makeDir($dir)
    {
        $dirPath = base_path('app/'.ltrim($dir, '/'));

        if (!File::exists($dirPath)) {
            File::makeDirectory($dirPath);
        }
    }
1373457
public function setDir($dir = null){
        $this->databaseDir = (is_null($dir)) ? realpath(__DIR__).DIRECTORY_SEPARATOR.'database'.DIRECTORY_SEPARATOR : $dir;
        return $this;
    }
85405
public function setTmpDir ($dir)
		{
			$this->_tmpDir = $dir . '/' . $this->_params[ 'identifier' ];
			if (!is_dir($this->_tmpDir))
				FileHelper::createDirectory($this->_tmpDir);
		}
395411
public void setWorkDir(String dir) throws IOException
    {
        File workDir = new File(dir);

        if (!workDir.exists() || !workDir.canWrite() || !workDir.canRead())
        {
            throw new IOException("Cannot access directory "+dir);
        }
        _workDir = workDir;
    }
2309
public function setRootDir($rootDir)
    {
        if (!is_dir($rootDir)) {
            throw new \InvalidArgumentException(
                sprintf('Invalid Application Configuration Directory: %s', $rootDir)
            );
        }

        $this->rootDir = $rootDir;
    }
1026588
protected function dirExists($dir)
    {
        if ($this->files->exists($dir)) {

            if ( ! $this->files->isDirectory($dir)) {
                throw new RuntimeException("The given directory [$dir] is not a directory.");
            }

            return true;
        }

        return false;
    }
142285
public function setLogDirectory($dir)
    {
        if ($dir && file_exists($dir) && is_dir($dir)) {
            $this->logDir = $dir;
        } elseif (null === $dir) {
            $this->logDir = null;
        }
    }
337709
public function setCompileDir($dir)
    {
        $this->compileDir = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR;
        if (!file_exists($this->compileDir)) {
            mkdir($this->compileDir, 0777, true);
        }
        if (is_writable($this->compileDir) === false) {
            throw new Exception('The compile directory must be writable, chmod "' . $this->compileDir . '" to make it writable');
        }
    }