Skip to content

Commit

Permalink
[BF04 - 0.0.12.x Final] Backported fix 6e49432
Browse files Browse the repository at this point in the history
Made NeutralizePath() normalize the path in special cases
  • Loading branch information
AptiviCEO committed Aug 22, 2023
1 parent d546d5b commit fec0961
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Kernel Simulator/Files/Filesystem.vb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Public Module Filesystem
''' </summary>
''' <param name="Path">Target path, be it a file or a folder</param>
''' <returns>Absolute path</returns>
Public Function NeutralizePath(ByVal Path As String)
Public Function NeutralizePath(ByVal Path As String) As String
Path = Path.Replace("\", "/")
If (EnvironmentOSType.Contains("Windows") And Not Path.Contains(":/")) Or (EnvironmentOSType.Contains("Unix") And Not Path.StartsWith("/")) Then
If Not CurrDir.EndsWith("/") Then
Expand All @@ -145,6 +145,7 @@ Public Module Filesystem
Path = Manipulation.ReplaceLastOccurrence(Path, CurrDir, "")
End If
End If
Path = IO.Path.GetFullPath(Path).Replace("\", "/")
Wdbg("I", "Final directory: {0}", Path)
Return Path
End Function
Expand All @@ -155,7 +156,7 @@ Public Module Filesystem
''' <param name="Path">Target path, be it a file or a folder</param>
''' <param name="Source">Source path in which the target is found. Must be a directory</param>
''' <returns>Absolute path</returns>
Public Function NeutralizePath(ByVal Path As String, ByVal Source As String)
Public Function NeutralizePath(ByVal Path As String, ByVal Source As String) As String
Path = Path.Replace("\", "/")
Source = Source.Replace("\", "/")
If (EnvironmentOSType.Contains("Windows") And Not Path.Contains(":/")) Or (EnvironmentOSType.Contains("Unix") And Not Path.StartsWith("/")) Then
Expand All @@ -171,6 +172,7 @@ Public Module Filesystem
Path = Manipulation.ReplaceLastOccurrence(Path, Source, "")
End If
End If
Path = IO.Path.GetFullPath(Path).Replace("\", "/")
Wdbg("I", "Final directory: {0}", Path)
Return Path
End Function
Expand Down

0 comments on commit fec0961

Please sign in to comment.