Find an asset.

@param string $asset Asset name.
@return string|null Asset path on server, or null if not found.
328039
public function find($asset)
    {
        $asset = trim($asset, '/');
        $namespace = '/';
        while (true) {
            $file = $this->findIn($asset, $namespace);
            if (isset($file)) {
                return $file;
            }
            $pos = strpos($asset, '/');
            if ($pos === false) {
                break;
            }
            $namespace = rtrim($namespace, '/') . '/' . substr($asset, 0, $pos);
            $asset = substr($asset, $pos + 1);
        }
        return null;
    }
685243
protected function filterProvidedAssets($asset)
    {
        foreach ($this->providedAssetGroup->getAssetPointers() as $pass) {
            if ($pass->getHandle() == $asset->getHandle() && $pass->getType() == $asset->getType()) {
                return false;
            }
        }

        // now is the unmatched assets something that matches this asset?
        // (ie, is it a path-style match, like bootstrap/* )
        foreach ($this->providedAssetGroupUnmatched as $assetPointer) {
            if ($assetPointer->getType() == $asset->getType() && fnmatch($assetPointer->getHandle(), $asset->getHandle())) {
                return false;
            }
        }

        return true;
    }
1053478
protected function assetBaseUrl($plugin, $asset)
    {
        $dir  = dirname($asset);
        $path = !empty($dir) && $dir != '.' ? "/$dir" : null;

        return $this->Url->assetUrl($plugin . $path);
    }
1347190
public function findIn($asset, $namespace)
    {
        if (! isset($this->paths[$namespace])) {
            return null;
        }
        foreach ($this->paths[$namespace] as $path) {
            $file = $path['path'] . $asset;
            if (is_file($file)) {
                return $file;
            }
        }
        return null;
    }
209976
protected function buildVersion($asset)
    {
        $version = $this->getVersion();

        if (is_callable($version)) {

            $version = $version($this->getBasePath() . $asset, $this);
        }

        return $version;
    }
1012623
public function asset(string $group, ?array $asset = null): string
    {
        if (! isset($asset)) {
            return '';
        }

        $asset['source'] = $this->getAssetSourceUrl($asset['source']);

        $html = $this->html->{$group}($asset['source'], $asset['attributes']);

        return $html->toHtml();
    }
740677
public function find(string $path): AssetFileInterface
    {
        if ($this->isExternal($path)) {
            return (new File($this->files))
                ->setPath('')
                ->setUrl($path)
                ->setExternal(true)
                ->setType($path);
        }

        $path = trim($path, '\/');

        foreach ($this->locations as $dir => $url) {
            if ($this->files->exists($fullPath = $dir.'/'.$path)) {
                return (new File($this->files))
                    ->setPath($fullPath)
                    ->setUrl($url.'/'.$path)
                    ->setExternal(false)
                    ->setType($fullPath);
            }
        }

        throw new AssetException('Unable to find the asset with the following path: '.$path);
    }
218476
public static function findInPath($filename, $path)
    {
        $asset_path = DirectoryHelper::slashDirname($path) . $filename;
        if (file_exists($asset_path)) {
            return self::buildWebPath($asset_path);
        }
        return null;
    }
1244494
public function getRealPath()
    {
        if(null === $this->asset || empty($this->asset)) {
            return null;
        }

        return $this->normalizePath($this->realPath($this->realPath));
    }
839513
protected function getAssetScheme($asset)
    {
        if (starts_with($asset, ['//', 'http://', 'https://'])) {
            return $asset;
        }

        if (substr($asset, 0, 1) == '/') {
            $asset = Url::asset($asset);
        }

        return $asset;
    }
223818
public function getAssetParentAssets($asset)
    {
        $assetId = Utilities::getEntityId(
            $asset,
            'WindowsAzure\MediaServices\Models\Asset'
        );

        $propertyList = $this->_getEntityList("Assets('{$assetId}')/ParentAssets");
        $result = [];

        foreach ($propertyList as $properties) {
            $result[] = Asset::createFromOptions($properties);
        }

        return $result;
    }
223789
private function getAssetPath(AssetFileModel $asset)
    {
        if ($asset->getSource()->type != 'Local') {
            throw new Exception(Craft::t('Could not get asset upload path as source is not "Local"'));
        }

        $sourcePath = $asset->getSource()->settings['path'];
        $folderPath = $asset->getFolder()->path;

        return $sourcePath . $folderPath . $asset->filename;
    }
810256
public function getAsset($asset, $extensionId = null)
    {
        if( ! is_null($extensionId)){
            $url = $this->getJsBaseWww($extensionId) . FsUtils::normalizePath($asset);
        } else {
            $url = $this->getAssetBaseUrl() . FsUtils::normalizePath($asset);
        }

        $isFolder = (substr_compare($url, '/', strlen($url) - 1) === 0);

        $buster = $this->getCacheBuster();
        if($buster != false && $isFolder == false) {
            $url .= '?' . self::BUSTER_QUERY_KEY . '=' . urlencode($buster);
        }

        return $url;
    }
949276
public function get(string $path): SplFileInfo
    {
        $path = ltrim($path, '\\/');
        foreach ($this->assets as $asset) {
            if ($asset->getRelativePathname() === $path) {
                return $asset;
            }
        }
        throw new NotFoundHttpException(sprintf('Unknown asset: %s', $path));
    }
905615
public static function get_asset_url($file)
    {
        if (static::$manifest === null) {
            static::parse_manifest();
        }

        // There was no manifest or no file present.
        if (static::$manifest === null || !isset(static::$manifest[ $file ])) {
            return get_stylesheet_directory_uri() . '/public' . $file;
        }

        return get_stylesheet_directory_uri() . '/public' . static::$manifest[ $file ];
    }
12760
protected function getPath(): ?string
    {
        $path = $this->input->getOption('path');

        // First we will check for an explicitly specified path from the user. If one
        // exists we will use that as the path to the assets. This allows the free
        // storage of assets wherever is best for this developer's web projects.
        if (\is_null($path)) {
            return null;
        }

        return $this->laravel->basePath().'/'.$path;
    }
540534
public function getAsset()
    {
        if ($this->asset === null) {
            $this->asset = AssetFacade::find($this->getAssetId());
        }

        return $this->asset;
    }