A contents manager that passes file operations to the server. Multiple servers implementing the IDrive interface can be attached to the contents manager, so that the same session can perform file operations on multiple backends.

This includes checkpointing with the normal file operations.

Implements

Constructors

Properties

_additionalDrives: Map<string, IDrive> = ...
_defaultDrive: IDrive
_isDisposed: boolean = false
serverSettings: ServerConnection.ISettings

The server settings associated with the manager.

Accessors

Methods

  • Given a path, get the IDrive to which it refers, where the path satisfies the pattern 'driveName:path/to/file'. If there is no driveName` prepended to the path, it returns the default drive.

    @param path a path to a file.

    @returns A tuple containing an IDrive object for the path, and a local path for that drive.

    Parameters

    • path: string

    Returns [IDrive, string]

  • Given a drive and a local path, construct a fully qualified path. The inverse of _driveForPath.

    Parameters

    • drive: IDrive

      an IDrive.

    • localPath: string

      the local path on the drive.

    Returns string

    the fully qualified path.

  • Given a path of the form drive:local/portion/of/it.txt get the name of the drive. If the path is missing a drive portion, returns an empty string.

    Parameters

    • path: string

      the path.

    Returns string

    The drive name for the path, or the empty string.

  • Normalize a global path. Reduces '..' and '.' parts, and removes leading slashes from the local part of the path, while retaining the drive name if it exists.

    Parameters

    • path: string

      the path.

    Returns string

    The normalized path.

  • Resolve a global path, starting from the root path. Behaves like posix-path.resolve, with 3 differences:

    • will never prepend cwd
    • if root has a drive name, the result is prefixed with ":"
    • before adding drive name, leading slashes are removed

    Parameters

    • root: string
    • path: string

      the path.

    Returns string

    The normalized path.