function FileTransfer::sanitizePath

7.x filetransfer.inc FileTransfer::sanitizePath($path)

Changes backslashes to slashes, also removes a trailing slash.

Parameters

string $path:

Return value

string

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

drupal-7.x/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;
}