You are here

protected function BackendBase::getAbsoluteFilePath in SCSS Compiler 1.0.x

Retrieve an absolute file path for the supplied input file.

If the supplied context is a theme compiler context, then it will be used to resolve theme-relative file paths.

Parameters

\Drupal\compiler\CompilerContextInterface $context: A compiler context used to define a compilation.

string $path: A path, possibly theme-relative.

Return value

string An absolute file path for the supplied input file.

Throws

\RuntimeException If the resulting absolute file path doesn't exist.

2 calls to BackendBase::getAbsoluteFilePath()
BackendBase::getImportPath in src/BackendBase.php
Attempt to retrieve the absolute import path for the compiler.
BackendBase::getInput in src/BackendBase.php
Retrieve the source code to pass to the compiler.

File

src/BackendBase.php, line 60

Class

BackendBase
Provides a base compiler backend implementation.

Namespace

Drupal\compiler_scss

Code

protected function getAbsoluteFilePath(CompilerContextInterface $context, string $path) {
  if (($result = realpath($path)) === FALSE) {
    throw new \RuntimeException('Unable to resolve file path: ' . var_export($path, TRUE));
  }
  return $result;
}