RemotePath.TranslateLocalPathToRemote Method

Generates a remote path equivalent of a local path, given root paths.

Advertisement

Syntax

C#
public static string TranslateLocalPathToRemote(
    string localPath,
    string localRoot,
    string remoteRoot
)
VB.NET
Public Shared Function TranslateLocalPathToRemote(
    localPath As String,
    localRoot As String,
    remoteRoot As String
) As String

Parameters

Name Description
string localPath An absolute local path to translate.
string localRoot An absolute path to a local root folder that is an equivalent of the remoteRoot.
string remoteRoot An absolute path to a remote root folder that is an equivalent of the localRoot.

Return Value

A remote path equivalent of the local path.

Exceptions

Exception Condition
InvalidOperationException The localPath is not within localRoot.
ArgumentNullException Some of the arguments is null.

Advertisement

Remarks

Basically replaces localRoot with remoteRoot in localPath and converts all backslashes (\) to slashes (/).

It makes no difference if localRoot and remoteRoot end with slash (backslash) or not.

For an opposite operation, see RemotePath.TranslateRemotePathToLocal.

Examples

Real-Life Example

Last modified: by martin