function FileTransfer::sanitizePath

Changes backslashes to slashes, also removes a trailing slash.

Parameters

string $path: The path to modify.

Return value

string The modified path.

4 calls to FileTransfer::sanitizePath()
FileTransfer::chmod in drupal/core/lib/Drupal/Core/FileTransfer/FileTransfer.php
Changes the permissions of the specified $path (file or directory).
FileTransfer::copyDirectory in drupal/core/lib/Drupal/Core/FileTransfer/FileTransfer.php
Copies a directory.
FileTransfer::copyFile in drupal/core/lib/Drupal/Core/FileTransfer/FileTransfer.php
Copies a file.
FileTransfer::fixRemotePath in drupal/core/lib/Drupal/Core/FileTransfer/FileTransfer.php
Returns a modified path suitable for passing to the server.

File

drupal/core/lib/Drupal/Core/FileTransfer/FileTransfer.php, line 260
Definition of Drupal\Core\FileTransfer\FileTransfer.

Class

FileTransfer
Defines the base FileTransfer class.

Namespace

Drupal\Core\FileTransfer

Code

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

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