Windream: Normalize BasePath
This commit is contained in:
@@ -133,7 +133,7 @@ Public Class Windream
|
||||
Me.ClientDriveLetter = ClientDriveLetter
|
||||
Me.ClientSupports64Bit = ClientSupport64Bit
|
||||
Me.SessionServername = SessionServerName
|
||||
Me.ClientBasePath = BasePath
|
||||
Me.ClientBasePath = GetNormalizedBasePath(BasePath)
|
||||
|
||||
_sessionUsername = SessionUserName
|
||||
_sessionPassword = SessionPassword
|
||||
@@ -760,6 +760,18 @@ Public Class Windream
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetNormalizedPath(Path As String) As String
|
||||
Dim oNormalizedPath = GetCleanedPath(Path)
|
||||
|
||||
If ClientDriveLetter <> String.Empty And Path.ToUpper().StartsWith(ClientDriveLetter.ToUpper) Then
|
||||
oNormalizedPath = Path.Substring(2)
|
||||
ElseIf Path.ToLower.StartsWith(ClientBasePath) Then
|
||||
oNormalizedPath = Path.Substring(ClientBasePath.Length)
|
||||
End If
|
||||
|
||||
Return oNormalizedPath
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Returns the result of a search file
|
||||
''' </summary>
|
||||
@@ -1282,16 +1294,12 @@ Public Class Windream
|
||||
#End Region
|
||||
|
||||
#Region "Private Methods"
|
||||
Private Function GetNormalizedPath(Path As String) As String
|
||||
Dim oNormalizedPath = GetCleanedPath(Path)
|
||||
|
||||
If Not Path.StartsWith("\") And Path.ToUpper().StartsWith(ClientDriveLetter.ToUpper) Then
|
||||
oNormalizedPath = Path.Substring(2)
|
||||
ElseIf Path.ToLower.StartsWith(ClientBasePath) Then
|
||||
oNormalizedPath = Path.Substring(ClientBasePath.Length)
|
||||
Private Function GetNormalizedBasePath(BasePath As String) As String
|
||||
If BasePath.EndsWith("\") Then
|
||||
Return BasePath
|
||||
Else
|
||||
Return BasePath & "\"
|
||||
End If
|
||||
|
||||
Return oNormalizedPath
|
||||
End Function
|
||||
|
||||
Private Function GetCleanedPath(Path As String) As String
|
||||
|
||||
Reference in New Issue
Block a user