1 filetransfer.inc | 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: The path to modify.
$strip_chroot: Whether to remove the path in $this->chroot.
Return value
string: The modified path.
File
- core/
includes/ filetransfer/ filetransfer.inc, line 304 - Base FileTransfer class.
Class
- FileTransfer
- @file Base FileTransfer class.
Code
protected final function fixRemotePath($path, $strip_chroot = TRUE) {
$path = $this->sanitizePath($path);
// Strip out Windows drive letter if it's there.
$path = preg_replace('|^([a-z]{1}):|i', '', $path);
if ($strip_chroot) {
if ($this->chrootPath && strpos($path, $this->chrootPath) === 0) {
$path = ($path == $this->chrootPath) ? '' : substr($path, strlen($this->chrootPath));
}
}
return $path;
}