You are here

function FileTransfer::sanitizePath in Drupal 7

Changes backslashes to slashes, also removes a trailing slash.

Parameters

string $path:

Return value

string

4 calls to FileTransfer::sanitizePath()
FileTransfer::chmod in includes/filetransfer/filetransfer.inc
FileTransfer::copyDirectory in includes/filetransfer/filetransfer.inc
Copies a directory.
FileTransfer::copyFile in includes/filetransfer/filetransfer.inc
Copies a file.
FileTransfer::fixRemotePath in includes/filetransfer/filetransfer.inc
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.

File

includes/filetransfer/filetransfer.inc, line 194

Class

FileTransfer

Code

function sanitizePath($path) {
  $path = str_replace('\\', '/', $path);

  // Windows path sanitization.
  if (substr($path, -1) == '/') {
    $path = substr($path, 0, -1);
  }
  return $path;
}