Get full path to backups folder.
Directory will be automatically created.

@return string
@throws Exception
430768
public function getBackupFolder()
    {
        // Base backups folder
        $base = Yii::getAlias($this->backupsFolder);

        // Temp directory for current backup
        $current = $this->getBackupFilename();

        $fullpath = $base . DIRECTORY_SEPARATOR . $current;

        // Try to create new directory
        if (!is_dir($fullpath) && !mkdir($fullpath)) {
            throw new Exception('Can not create folder for backup: "' . $fullpath . '"');
        }

        return $fullpath;
    }
163492
public function getRestorationFiles($path = null)
	{
		if ($path === null) {
			$path = $this->getPath();
		}

		$results = [];

		if (!$this->getBackupFilesystemInstance()->checkPathExists($path)) {
			throw new BackupException('Unable to get restoration files as path "' . $path . '" doesn\'t exist');
		}

		try {
			foreach (new DirectoryIterator($path) as $fileinfo) {
				if ($fileinfo->isDot() ||
					!$fileinfo->isFile() ||
					in_array($fileinfo->getFilename(), BackupFilesystem::$ignoredFiles) ||
					substr($fileinfo->getFilename(), 0, 1) == '.'
				) {
					continue;
				}

				$results[] = $fileinfo->getPathname();
			}
		} catch (Exception $exception) {
			// Exception thrown continue and return empty result set
		}

		return $results;
	}
710767
public function getPath() : string
    {
        if ($this->fullPath !== null) {
            return $this->fullPath;
        }

        $path = $this->getSetting('path');

        if (is_dir($path)) {
            $this->verified = true;

            return $this->fullPath = realpath($path);
        }

        $pubPath = public_path(trim($path, '/'));

        $this->verified = is_dir($pubPath);

        return $this->fullPath = $pubPath;
    }
21230
public function getAbsloutPath()
    {
        $path = Pluf_Tenant::storagePath() . '/tenant-resources/' . $this->id;
        $dirname = dirname($path);
        if (! is_dir($dirname)) {
            mkdir($dirname, 0755, true);
            // FIXME: maso, 2019: throw exception if is not possible to create
        }
        return $path;
    }
328748
public function getRealPath()
	{
		$path	= realpath( $this->folderName );
		if( FALSE === $path )
			throw new RuntimeException( 'Folder "'.$this->folderName.'" is not existing and therefore has no Path' );
		return dirname( $path )."/";
	}
1137662
public function allDirectories()
    {
        $directories = $this->disk->allDirectories('/');

        return collect($directories)->filter(function ($directory) {
            return !(starts_with($directory, '.'));
        })->map(function ($directory) {
            return DIRECTORY_SEPARATOR.$directory;
        })->reduce(function ($allDirectories, $directory) {
            $parts = explode('/', $directory);
            $name = str_repeat('&nbsp;', (count($parts)) * 4).basename($directory);

            $allDirectories[$directory] = $name;

            return $allDirectories;
        }, collect())->prepend($this->breadcrumbRootLabel, '/');
    }
953750
public function getThumbPath()
    {
        return (!empty($this->thumb_path) ? str_replace($this->getThumbRootDir(), '', DirectoryHelper::slashDirname($this->thumb_path)) : '');
    }
350358
public function getDirOutput() {
        $ds = DIRECTORY_SEPARATOR;
        $id = $this->getId();
        $documentsPath = $this->exporterManager->getOption("documents_path");
        $env = $this->exporterManager->getOption("env");
        if($this->basePath === null){
            $fullPath = $documentsPath.$ds.$env.$ds.$id;
        }else{
            $fullPath = $this->basePath;
        }
        if($this->subPath !== null){
            $fullPath .= $ds.$this->subPath;
        }
        
        if(!$this->exporterManager->getFs()->exists($fullPath)){
            $this->exporterManager->getFs()->mkdir($fullPath);
        }
        return $fullPath;
    }
1285188
public function get_rootpath() {
        global $CFG;
        $subdir = clean_param(trim($this->subdir, '/'), PARAM_PATH);
        $path = $CFG->dataroot . '/repository/' . $this->subdir . '/';
        if ((empty($this->subdir) && !is_numeric($this->subdir)) || $subdir != $this->subdir || !is_dir($path)) {
            throw new repository_exception('The instance is not properly configured, invalid path.');
        }
        return $path;
    }
255492
public function getBaseDir(): string
    {
        // Four levels back.
        $ds = DIRECTORY_SEPARATOR;
        $dir = __DIR__ . "$ds..$ds..$ds..$ds..$ds";
        $base_dir = realpath($dir);
        if (!$base_dir) {
            $message = 'Cannot resolve project base directory.';
            throw new Exception\RuntimeException($message);
        }

        return $base_dir;
    }
615047
public function getHomeDirectory()
    {
        if (!array_key_exists(self::HOME_DIRECTORY, $this->passwd)) {
            throw new \Exception('Could not get user\'s home directory from passwd.');
        }
        return $this->passwd[self::HOME_DIRECTORY];
    }
1309225
private function getFilePath()
    {
        $fullName = $this->fullName;
        if (substr($fullName, 0, 1) != '/') {
            $fullName = '/' . $fullName;
        }
        return $this->getSetting('storePath') . $fullName;
    }
22214
private function getTokenFilePath()
    {
        if ($this->tokenDirectory === null) {
            throw new \Dropbox\Exception('OAuth token directory not set. See Filesystem::setDirectory()');
        } else {
            return $this->tokenDirectory . '/' . md5($this->userID) . '.token';
        }
    }
1132793
public function getTempPath()
    {
        if (is_null($this->_tempPath)) {
            $this->_tempPath = sys_get_temp_dir();
        }
        if (!is_dir($this->_tempPath)) {
            @mkdir($this->_tempPath, 0755, true);
            if (!is_dir($this->_tempPath)) {
                throw new Exception("Unable to create temporary path folder {$this->_tempPath}");
            }
        }

        return $this->_tempPath;
    }
273511
public function getDirectory()
    {
        return substr($this->getPath(), -1) == '/'
            ? substr($this->getPath(), 0, -1)
            : dirname($this->getPath());
    }
311112
private function getDirectory()
    {
        // Fallback to default directory if no storage path defined
        if (defined('CRAFT_STORAGE_PATH')) {
            $basePath = CRAFT_STORAGE_PATH;
        } else {
            $basePath = CRAFT_BASE_PATH . DIRECTORY_SEPARATOR . 'storage';
        }

        return $basePath . DIRECTORY_SEPARATOR . 'runtime' . DIRECTORY_SEPARATOR . 'htmlcache' . DIRECTORY_SEPARATOR;
    }
923501
private function getDirectoryPath()
    {
        $path = $this->config['directory'];

        // Create directory if not exists
        if (!is_dir($path)) {
            mkdir($path, 0755, true);
        }

        return $path . DIRECTORY_SEPARATOR;
    }