You are here

public function AmazonS3StreamWrapper::dirname in AmazonS3 7

Gets the name of the directory from a given path.

This method is usually accessed through drupal_dirname(), which wraps around the normal PHP dirname() function, which does not support stream wrappers.

Parameters

string $uri: An optional URI.

Return value

string A string containing the directory name, or FALSE if not applicable.

Overrides DrupalStreamWrapperInterface::dirname

See also

drupal_dirname()

File

./AmazonS3StreamWrapper.inc, line 396
Drupal stream wrapper implementation for Amazon S3

Class

AmazonS3StreamWrapper
@file Drupal stream wrapper implementation for Amazon S3

Code

public function dirname($uri = NULL) {
  list($scheme, $target) = explode('://', $uri, 2);
  $target = $this
    ->getTarget($uri);
  $dirname = dirname($target);
  if ($dirname === '.') {
    $dirname = '';
  }
  return $scheme . '://' . $dirname;
}