protected final function FileTransfer::fixRemotePath

protected final FileTransfer::fixRemotePath($path, $strip_chroot = TRUE)

Returns a modified path suitable for passing to the server. If a path is a windows path, makes it POSIX compliant by removing the drive letter. If $this->chroot has a value, it is stripped from the path to allow for chroot'd filetransfer systems.

Parameters

$path:

$strip_chroot:

Return value

string

File

includes/filetransfer/filetransfer.inc, line 177

Class

FileTransfer

Code

protected final function fixRemotePath($path, $strip_chroot = TRUE) {
  $path = $this->sanitizePath($path);
  $path = preg_replace('|^([a-z]{1}):|i', '', $path); // Strip out windows driveletter if its there.
  if ($strip_chroot) {
    if ($this->chroot && strpos($path, $this->chroot) === 0) {
      $path = ($path == $this->chroot) ? '' : substr($path, strlen($this->chroot));
    }
  }
  return $path;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!filetransfer!filetransfer.inc/function/FileTransfer::fixRemotePath/7.x