You are here

function FileTransfer::sanitizePath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\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 core/lib/Drupal/Core/FileTransfer/FileTransfer.php
Changes the permissions of the specified $path (file or directory).
FileTransfer::copyDirectory in core/lib/Drupal/Core/FileTransfer/FileTransfer.php
Copies a directory.
FileTransfer::copyFile in core/lib/Drupal/Core/FileTransfer/FileTransfer.php
Copies a file.
FileTransfer::fixRemotePath in core/lib/Drupal/Core/FileTransfer/FileTransfer.php
Returns a modified path suitable for passing to the server.

File

core/lib/Drupal/Core/FileTransfer/FileTransfer.php, line 257
Contains \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;
}