Get the path to a view using the default folder convention.

@param  string  $bundle
@param  string  $view
@param  string  $directory
@return string
553985
public static function file($bundle, $view, $directory)
	{
		$directory = str_finish($directory, DS);

		// Views may have either the default PHP file extension or the "Blade"
		// extension, so we will need to check for both in the view path
		// and return the first one we find for the given view.
		if (file_exists($path = $directory.$view.EXT))
		{
			return $path;
		}
		elseif (file_exists($path = $directory.$view.BLADE_EXT))
		{
			return $path;
		}
	}
268724
protected function generateEditView($dir)
    {
        $parts = explode('\\', $this->entity);
        $entityClass = array_pop($parts);

        $this->renderFile(
            'views/edit.html.twig',
            $dir.'/edit.html.twig',
            array(
                'dir' => $this->skeletonDir,
                'route_prefix' => $this->routePrefix,
                'route_name_prefix' => $this->routeNamePrefix,
                'entity' => $this->entity,
                'actions' => $this->actions,
                'bundle' => $this->bundle->getName(),
                'entity_class' => $entityClass,
            )
        );
    }
694815
protected function generateShowView($dir)
    {
        $this->renderFile('crud/views/show.html.twig.twig', $dir . '/show.html.twig', array(
            'bundle' => $this->bundle->getName(),
            'entity' => $this->entity,
            'entity_singularized' => $this->entitySingularized,
            'identifier' => $this->metadata->identifier[0],
            'fields' => $this->metadata->fieldMappings,
            'actions' => $this->actions,
            'route_prefix' => $this->config->getRoutePrefix(),
            'route_name_prefix' => $this->routeNamePrefix,
            'base_template' => $this->config->getBaseTemplate(),
        ));
    }
1241468
protected function view_path( $view )
	{
		if ( isset( static::$_view_paths[$view] ) )
		{
			return static::$_view_paths[$view];
		}
		
		// view is empty?
		if ( is_null( $view ) )
		{
			throw new CCException( "CCView - cannot render view without a view file." );
		}
		
		// generate the views path
		$path = CCPath::get( $view, CCDIR_VIEW, EXT );
		
		if ( !file_exists( $path ) ) 
		{
			throw new CCException( "CCView - could not find view: ".$view." at: {$path}." );
		}
		
		// does the view implement a view builder?
		if ( strpos( $view, '.' ) !== false )
		{
			$cache = static::cache_path( $view );
			
			// does the cache not exits or is out of date
			if ( !file_exists( $cache ) || filemtime( $cache ) < filemtime( $path ) )
			{
				list( $view_name, $builder ) = explode( '.', $view );
				$this->build_cache( $cache, $builder, $path );
			}
			
			$path = $cache;
		}
		
		return static::$_view_paths[$view] = $path;
	}
909388
protected function writeBundleFile($bundlePath, $data)
    {
        $dir = dirname($bundlePath);

        if (!file_exists($dir)) {
            mkdir($dir, 0777, true);
        }

        if (false === file_put_contents($bundlePath, $data, LOCK_EX)) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException('Cannot write cache file to "' . $bundlePath . '"');
            // @codeCoverageIgnoreEnd
        }

        return filemtime($bundlePath);
    }
129882
public function path($dir = '')
    {
        $path = $this->basePath . DIRECTORY_SEPARATOR . 'app';

        return $dir == '' ? $path : $path . DIRECTORY_SEPARATOR . rtrim($dir, '\/');
    }
939271
protected function getOutputDirectory(BundleSchemaInterface $bundleSchema, string $outputDirectory): string
    {
        $outputDirectory = \trim($outputDirectory);
        $outputDirectory = \str_replace('\\', \DIRECTORY_SEPARATOR, $outputDirectory);

        return $outputDirectory;
    }
983925
public function getPicturePath($file, $admin = false, $lang = null, $shop = null, $theme = null)
    {
        return $this->getDir($file, $this->_sPictureDir, $admin, $lang, $shop, $theme);
    }
933628
protected function locateBundleResource($name, $dir = null, $first = true)
    {
        if (false !== strpos($name, '..')) {
            throw new \RuntimeException(sprintf('File name "%s" contains invalid characters (..).', $name));
        }

        $bundleName = substr($name, 1);
        $path = '';
        if (false !== strpos($bundleName, '/')) {
            list($bundleName, $path) = explode('/', $bundleName, 2);
        }

        if (!preg_match('/(Bundle)$/i', $bundleName)) {
            $bundleName .= 'Bundle';
            if (0 !== strpos($path, 'Resources')) {
                $path = 'Resources/views/'.$path;
            }
        }

        if (0 !== strpos($path, 'Resources')) {
            throw new \RuntimeException('Template files have to be in Resources.');
        }

        $resourceBundle = null;
        $bundles = $this->kernel->getBundle($bundleName, false, true);
        // Symfony 4+ no longer supports inheritance and so we only get a single bundle
        if (!is_array($bundles)) {
            $bundles = array($bundles);
        }
        $files = array();

        $parameters = array(
            '%app_path%' => $this->path,
            '%dir%' => $dir,
            '%override_path%' => substr($path, strlen('Resources/')),
            '%current_theme%' => $this->lastTheme,
            '%current_device%' => $this->activeTheme->getDeviceType(),
            '%template%' => substr($path, strlen('Resources/views/')),
        );

        foreach ($bundles as $bundle) {
            $parameters = array_merge($parameters, array(
                '%bundle_path%' => $bundle->getPath(),
                '%bundle_name%' => $bundle->getName(),
            ));

            $checkPaths = $this->getPathsForBundleResource($parameters);

            foreach ($checkPaths as $checkPath) {
                if (file_exists($checkPath)) {
                    if (null !== $resourceBundle) {
                        throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.',
                            $path,
                            $resourceBundle,
                            $checkPath
                        ));
                    }

                    if ($first) {
                        return $checkPath;
                    }
                    $files[] = $checkPath;
                }
            }

            $file = $bundle->getPath().'/'.$path;
            if (file_exists($file)) {
                if ($first) {
                    return $file;
                }
                $files[] = $file;
                $resourceBundle = $bundle->getName();
            }
        }

        if (count($files) > 0) {
            return $first ? $files[0] : $files;
        }

        throw new \InvalidArgumentException(sprintf('Unable to find file "%s".', $name));
    }
1137370
public function setViewsDirectory(string $directory)
  {
    if (!is_dir($directory))
      return $this->exception(
        'Views directory "' . $directory . '" does not exist.'
      );

    $this->viewsDirectory = $directory;
    return $this;
  }
629365
public static function setBaseDirectory($directory)
    {
        if (!is_dir($directory))
            throw new \InvalidArgumentException('m\View\GenericView: Given string "'.$directory.'" is not a valid directory.');

        static::$_defaultDir = (string) rtrim($directory, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
    }
1358434
protected function generateFormView(AbstractResourceBundle $bundle)
    {
        $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/_form.html.twig';

        if (!file_exists($path)) {
            $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model;
            $metadata = $this->getEntityMetadata($entityClass);

            $this->renderFile('crud/_form.html.twig.twig',
                $bundle->getPath() . '/Resources/views/' . $this->model . '/_form.html.twig',
                array(
                    'fields'  => $this->getFieldsFromMetadata($metadata[0]),
                )
            );
        }
    }
1034736
public function getJsBundlePath()
    {
        $cacheDir = $this->getJsCachePath();

        if ($this->isRelativePath($cacheDir)) {
            $cacheDir = $this->getDocRoot() . DIRECTORY_SEPARATOR . $cacheDir;
        }

        $name = $this->getName();

        if (null === $name) {
            $name = sprintf('bundle_%s', $this->getJsFileList()->getHash());
        } elseif (strpos($name, '%s') !== false) {
            $name = sprintf($name, $this->getJsFileList()->getHash());
        }

        return sprintf(
            "%s%s%s.js",
            $cacheDir,
            DIRECTORY_SEPARATOR,
            $name
        );
    }
1168657
public function getViewPath()
    {
        if (! $this->base) {
            return $this->view;
        }

        return rtrim($this->base, DIRECTORY_SEPARATOR)
             . DIRECTORY_SEPARATOR
             . ltrim($this->view, DIRECTORY_SEPARATOR);
    }
1064566
protected function getDestinationPath($viewsDirectory)
    {
        $path = Config::getViewsPath();

        if (!empty($viewsDirectory)) {
            $path .= Helpers::getPathWithSlash($viewsDirectory);
        }

        return $path;
    }
563433
private function getViewFile($view)
    {
        $calledClass = $this->path;

        // Calculate path to view
        if (0 === strpos($calledClass, 'App')) {
            $path = (new KernelInjector)->build()->getAppDir();
        } else {
            $path = Autoload::getAlias('Micro');
        }

        $cl = strtolower(dirname(str_replace('\\', '/', $calledClass)));
        $cl = substr($cl, strpos($cl, '/'));

        if ($this->asWidget) {
            $path .= $cl.'/views/'.$view.'.php';
        } else {
            $className = str_replace('controller', '',
                strtolower(basename(str_replace('\\', '/', '/'.$this->path))));
            $path .= dirname($cl).'/views/'.$className.'/'.$view.'.php';
        }

        $path = str_replace('//', '/', $path);

        if (!file_exists($path)) {
            throw new Exception('View path `'.$path.'` not exists.');
        }

        return $path;
    }
970058
function directoryPath(&$directory) {
    if (substr($directory, 0, 1) != '/') {
      // Relative, and so assumed to be in Drupal's files folder: prepend this to
      // the given directory.
      // sanity check. need to verify /files exists before we do anything. see http://drupal.org/node/367138
      $files = file_create_path();
      file_check_directory($files, FILE_CREATE_DIRECTORY);
      $directory = file_create_path($directory);
    }
  }