calculates the relative basepath
@param  string $suffix if a suffix given, it will return basepath + filename, otherwise just the basepath
@return string
7737
public function getBasepath($suffix = null)
    {
        $relativeDirectory = '.';

        $givenRelativePath = dirname($this->getCurrentPage());

        if ($givenRelativePath === '/') {
            $givenRelativePath = '';
        }

        $depth = substr_count($givenRelativePath, '/');

        for ($i = 0; $i < $depth; $i++) {
            $relativeDirectory .= '/..';
        }

        if ($suffix) {
            return $relativeDirectory . '/' . $suffix;
        } else {
            return $relativeDirectory;
        }
    }
962838
public function getUrlAttribute($suffix = '')
    {
        if (!$this->exists) {
            return Cache::rememberForever('missing_photo', function () {
                return static::placeholder('No photo provided');
            });
        }

        if (!$this->processed) {
            return Cache::rememberForever('processing_photo', function () {
                return static::placeholder(
                    "This photo is\nbeing processed\nand will appear\nshortly"
                );
            });
        }

        return "/photo/{$this->photoId}$suffix.jpg";
    }
928970
public function basePath($basePath)
    {
        if (strlen($basePath) > 1 && substr($basePath, -1) === '/') {
            $this->basePath = substr($basePath, 0, -1);
        } else {
            $this->basePath = $basePath;
        }

        return $this;
    }
415559
protected function getRelativeRoot($relativeTo, $basePath, $baseUrl)
    {
        if ($relativeTo === self::RELATIVE_PATH) {
            return $basePath;
        }
        if ($relativeTo === self::RELATIVE_URL) {
            return $baseUrl;
        }
        return null;
    }
504737
public function path($filename)
    {
        if (preg_match('~^' . $this->base_directory . '~', $filename)) {
            return $filename;
        }

        return rtrim($this->base_directory, '/') . '/' . ltrim($filename, '/');
    }
747477
protected function baseUrlPath($suffix = null, array $query = [])
    {
        /** @var string $baseUrlPath */
        $baseUrlPath = $this->baseUrlPath;

        if (!empty($suffix)) {
            $suffix = ltrim($suffix, "\/");
            $baseUrlPath .= '/' . trim($suffix);
        }

        if (!empty($query)) {
            $queryString  = http_build_query($query);
            $baseUrlPath .= '?' . $queryString;
        }

        return $baseUrlPath;
    }
1368293
public function getId($suffix = null)
    {
        $id = parent::getId($suffix);
        $id .= '-' . $this->fieldName;
        return HtmlHelper::nameToId($id);
    }
723933
public function normalize($fileName, $suffix = 0)
    {
        if ($this->casePreservation === self::LOWER_CASE) {
            $fileName = strtolower($fileName);
        }

        $ret = preg_replace('/[^\w.]+/', '-', $fileName);
        $ret = preg_replace('/-+/', '-', $ret);

        if ($suffix !== 0) {
            $ext = (string)pathinfo($ret, PATHINFO_EXTENSION);
            $fn = (string)pathinfo($ret, PATHINFO_FILENAME);
            $ret = sprintf('%s-%d.%s', trim($fn, '.'), $suffix, $ext);
        }

        return $ret;
    }
812651
protected function absolutePath(string $file, string $base): string
    {
        return $file[0] !== DIRECTORY_SEPARATOR && !str_contains($file, ':')
            ? $base . DIRECTORY_SEPARATOR . $file
            : $file;
    }
410282
public function getBasePath()
    {
        if (null === $this->_basePath) {
            $class = Unit::getReflectionClass($this);
            $this->_basePath = dirname($class->getFileName());
        }
        return $this->_basePath;
    }
493687
public function setBasePath($basePath = null) {
        if ($basePath === null) {
            $filename = (isset($this->SERVER['SCRIPT_FILENAME']))
                      ? basename($this->SERVER['SCRIPT_FILENAME'])
                      : '';

            $baseUrl = $this->getBaseUrl();
            if (empty($baseUrl)) {
                $this->_basePath = '';
                return $this;
            }

            if (basename($baseUrl) === $filename) {
                $basePath = dirname($baseUrl);
            } else {
                $basePath = $baseUrl;
            }
        }

        if (substr(PHP_OS, 0, 3) === 'WIN') {
            $basePath = str_replace('\\', '/', $basePath);
        }

        $this->_basePath = rtrim($basePath, '/');
        return $this;
    }
193679
public function basePath($basePath = null)
    {
        if (null === $basePath) {
            return $this->basePath;
        }

        $this->basePath = $basePath;
        return $this;
    }
1123847
public function pathInBase($filename)
    {
        $filename  = str_replace('\\', '/', $filename);
        $path_root = str_replace('\\', '/', base_path() . '/');

        return str_replace($path_root, '', $filename);
    }
336695
public static function getClassShortName(
        string $class,
        string $suffix = ''
    ): string {
        $baseName = static::getClassBaseName($class);

        return preg_replace(sprintf('/%s$/', $suffix), '', $baseName);
    }
900756
public function getBasename($suffix = null)
    {
        if (null === $suffix) {
            $suffix = static::SEPARATOR_EXTENSION.$this->getExtension();
        }

        return parent::getBasename((string)$suffix);
    }
1308464
public function basePath(?string $basePath = null) {
        if ($basePath != null) {
            $this->basePath = $basePath;
        }
        return $this->basePath;
    }
747495
public static function get( $path, $prefix = '', $suffix = '' ) {
	
		if ( substr( $path, 0, 1 ) == '/' || substr( $path, 0, 3 ) == "::/" ) {
			return $path.$suffix;
		} 

		if ( strpos( $path, '::' ) === false ) {
			return \APPPATH.$prefix.$path.$suffix;
		}
		
		$name = explode( '::', $path );
		
		// do we have a namepsace
		if ( array_key_exists( $name[0], \CCFinder::$bundles ) ) 
		{
			return \CCFinder::$bundles[$name[0]].$prefix.$name[1].$suffix;
		}
		
		return false;
	}