You are here

protected function S3fsStreamWrapper::getTarget in S3 File System 7

Returns the local writable target of the resource within the stream.

This function should be used in place of calls to realpath() or similar functions when attempting to determine the location of a file. While functions like realpath() may return the location of a read-only file, this method may return a URI or path suitable for writing that is completely separate from the URI used for reading.

Parameters

string $uri: Optional URI.

Return value

array Returns a string representing a location suitable for writing of a file, or FALSE if unable to write to the file such as with read-only streams.

1 call to S3fsStreamWrapper::getTarget()
S3fsStreamWrapper::dirname in ./S3fsStreamWrapper.inc
Gets the name of the directory from a given path.

File

./S3fsStreamWrapper.inc, line 425
Drupal stream wrapper implementation for S3 File System.

Class

S3fsStreamWrapper
The stream wrapper class.

Code

protected function getTarget($uri = NULL) {
  $this
    ->_debug("getTarget({$uri}) called.");
  if (!isset($uri)) {
    $uri = $this->uri;
  }
  $data = explode('://', $uri, 2);

  // Remove erroneous leading or trailing forward-slashes and backslashes.
  return isset($data[1]) ? trim($data[1], '\\/') : FALSE;
}