Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Returns canonicalized absolute pathname
<?php realpath(string $path): string|false
<?php         $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));

        $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));

        $useGlobalIncludePath = (bool) $config->get('use-include-path');

        $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
<?php         $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));

        $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));

        $useGlobalIncludePath = (bool) $config->get('use-include-path');

        $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';

        $targetDir = $vendorPath.'/'.$targetDir;
<?php         $targetDir = $vendorPath.'/'.$targetDir;

        $filesystem->ensureDirectoryExists($targetDir);



        $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);

        $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);



        $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
<?php         $filesystem->ensureDirectoryExists($targetDir);



        $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);

        $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);



        $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);

        $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
<?php             if (file_exists($dir)) {


                $dirMatch = preg_quote(strtr(realpath($dir), '\\', '/'));

                foreach ($excluded as $index => $pattern) {


                    $pattern = Preg::replace('{^(([^.+*?\[^\]$(){}=!<>|:\\\\#-]+|\\\\[.+*?\[^\]$(){}=!<>|:#-])*).*}', '$1', $pattern);
<?php         $filesystem = new Filesystem();



        $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";

        $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";

        $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";

        $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
<?php         $filesystem = new Filesystem();



        $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";

        $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";

        $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";

        $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
<?php         $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";

        $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";

        $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";

        $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";



        $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
<?php         $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";

        $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";

        $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";

        $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";



        $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);

        $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);
<?php                             $installPath = strtr(getcwd(), '\\', '/');

                        }



                        $resolvedPath = realpath($installPath . '/' . $updir);

                        $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path . '($|/)';

                        continue;

                    }
<?php         $map = array();

        $filesystem = new Filesystem();

        $cwd = realpath(getcwd());



        foreach ($path as $file) {

            $filePath = $file->getPathname();
<?php                 $filePath = Preg::replace('{[\\\\/]{2,}}', '/', $filePath);

            }



            $realPath = realpath($filePath);
<?php         );



        foreach ($cachePaths as $key => $cachePath) {

            $cachePath = realpath($cachePath);

            if (!$cachePath) {

                $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
<?php         if (

            ($configFile === 'composer.json' || $configFile === './composer.json')

            && !file_exists($configFile)

            && realpath(getcwd()) === realpath($this->config->get('home'))

        ) {

            file_put_contents($configFile, "{\n}\n");

        }
<?php         $authConfigFile = $input->getOption('global')

            ? ($this->config->get('home') . '/auth.json')

            : dirname(realpath($configFile)) . '/auth.json';



        $this->authConfigFile = new JsonFile($authConfigFile, null, $io);

        $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);