diff --git a/GBM/Managers/mgrPath.vb b/GBM/Managers/mgrPath.vb index 8afbf4d..93950a3 100644 --- a/GBM/Managers/mgrPath.vb +++ b/GBM/Managers/mgrPath.vb @@ -118,21 +118,23 @@ Public Class mgrPath Dim i As Integer = 0 Dim iRemove As Integer = 0 Dim iBackFolders As Integer = 0 - Dim bDeep As Boolean - Dim cPathChars As Char() = {"\", "/"} + Dim bDeep As Boolean + Dim cDS As Char = Path.DirectorySeparatorChar 'Set the directory seperator based on the OS - 'We are working with a case insenstive file system, ensure a uniform case - sProcessPath = sProcessPath.ToLower - sSavePath = sSavePath.ToLower + 'If we are working with a case insenstive file system, use a uniform case. **Look into removing this completely** + If cDS <> "/" Then 'Checking the seperator to determine OS is better than messing with enumerations that weren't always supported + sProcessPath = sProcessPath.ToLower + sSavePath = sSavePath.ToLower + End If 'We need to ensure we have a single trailing slash on the parameters - sProcessPath = sProcessPath.TrimEnd(cPathChars) - sSavePath = sSavePath.TrimEnd(cPathChars) - sProcessPath &= "/" - sSavePath &= "/" + sProcessPath = sProcessPath.TrimEnd(cDS) + sSavePath = sSavePath.TrimEnd(cDS) + sProcessPath &= cDS + sSavePath &= cDS 'Determines the direction we need to go, we always want to be relative to the process location - If sSavePath.Split(cPathChars).Length > sProcessPath.Split(cPathChars).Length Then + If sSavePath.Split(cDS).Length > sProcessPath.Split(cDS).Length Then sPath1 = sProcessPath sPath2 = sSavePath bDeep = True @@ -143,8 +145,8 @@ Public Class mgrPath End If 'Build an array of folders to work with from each path - sPath1Array = sPath1.Split(cPathChars) - sPath2Array = sPath2.Split(cPathChars) + sPath1Array = sPath1.Split(cDS) + sPath2Array = sPath2.Split(cDS) 'Take the shortest path and remove the common folders from both For Each s As String In sPath1Array @@ -156,25 +158,25 @@ Public Class mgrPath Next 'Remove the trailing slashes - sPath1 = sPath1.TrimEnd(cPathChars) - sPath2 = sPath2.TrimEnd(cPathChars) + sPath1 = sPath1.TrimEnd(cDS) + sPath2 = sPath2.TrimEnd(cDS) 'Determine which way we go If bDeep Then If sPath1.Length > 0 Then - iBackFolders = sPath1.Split(cPathChars).Length + iBackFolders = sPath1.Split(cDS).Length End If sResult = sPath2 Else If sPath2.Length > 0 Then - iBackFolders = sPath2.Split(cPathChars).Length + iBackFolders = sPath2.Split(cDS).Length End If sResult = sPath1 End If 'Insert direction modifiers based on how many folders are left For i = 1 To iBackFolders - sResult = ".." & Path.DirectorySeparatorChar & sResult + sResult = ".." & cDS & sResult Next i 'Done