You are here

protected function JmesRuntimeFactory::getCompileDirectory in Feeds extensible parsers 8

Returns the compilation directory.

Return value

string The directory JmesPath uses to store generated code.

1 call to JmesRuntimeFactory::getCompileDirectory()
JmesRuntimeFactory::createRuntime in src/JmesRuntimeFactory.php
Creates a runtime object.

File

src/JmesRuntimeFactory.php, line 59

Class

JmesRuntimeFactory
Defines a factory for generating JMESPath runtime objects.

Namespace

Drupal\feeds_ex

Code

protected function getCompileDirectory() {

  // Look for a previous directory.
  $directory = \Drupal::state()
    ->get('feeds_ex_jmespath_compile_dir');

  // The temp directory doesn't exist, or has moved.
  if (!$this
    ->validateCompileDirectory($directory)) {
    $directory = $this
      ->generateCompileDirectory();
    \Drupal::state()
      ->set('feeds_ex_jmespath_compile_dir', $directory);

    // Creates the directory with the correct perms. We don't check the
    // return value since if it didn't work, there's nothing we can do. We
    // just fallback to the AstRuntime anyway.
    $this
      ->validateCompileDirectory($directory);
  }
  return $directory;
}