You are here

public static function VendorStreamWrapper::basePath in Vendor Stream Wrapper 8

Returns the base path for vendor://.

Return value

string The base path for vendor://.

Overrides VendorStreamWrapperInterface::basePath

2 calls to VendorStreamWrapper::basePath()
VendorStreamWrapper::getDirectoryPath in src/StreamWrapper/VendorStreamWrapper.php
Gets the path that the wrapper is responsible for.
VendorStreamWrapperAssetOptimizer::optimize in src/Asset/VendorStreamWrapperAssetOptimizer.php
Optimizes an asset.

File

src/StreamWrapper/VendorStreamWrapper.php, line 48

Class

VendorStreamWrapper
Creates a vendor:// stream wrapper, for files in the vendor folder.

Namespace

Drupal\vendor_stream_wrapper\StreamWrapper

Code

public static function basePath() {
  if ($custom_path = Settings::get('vendor_file_path')) {
    return $custom_path;
  }
  elseif (is_dir('../vendor')) {
    return '../vendor';
  }
  elseif (is_dir('vendor')) {
    return 'vendor';
  }
  throw new VendorDirectoryNotFoundException();
}