$path = './file.txt'; $backPath = GeneralUtility::resolveBackPath($path, getcwd()); $absolutePath = realpath($backPath); echo $absolutePath;
$path = '../my-extension/somefile.txt'; $base = PATH_site; $resolvedPath = GeneralUtility::resolveBackPath($path, $base); echo $resolvedPath;In this example, we are passing the `PATH_site` constant as the base path parameter, which is the absolute path to the root directory of the TYPO3 installation. The `resolveBackPath` method then resolves the relative path `../my-extension/somefile.txt` to its absolute path within the TYPO3 installation. Package/library: TYPO3 CMS Core Utility.