From 379e3ab92f9f67927d2a0e1a70853e27237323f9 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 6 Jul 2023 11:03:46 +0200 Subject: [PATCH] [Debugger] Handle backslashes in paths --- src/Libs/FShade.Debug/ProjectData.fs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Libs/FShade.Debug/ProjectData.fs b/src/Libs/FShade.Debug/ProjectData.fs index ee2eb34..55e7ce5 100644 --- a/src/Libs/FShade.Debug/ProjectData.fs +++ b/src/Libs/FShade.Debug/ProjectData.fs @@ -2,6 +2,7 @@ open System.IO open System.Xml +open System.Text.RegularExpressions open System.Collections.Generic open Aardvark.Base @@ -27,6 +28,11 @@ module internal ProjectData = let private cache = Dictionary() + // Replaces back and forward slashes in a path with environment's directory separator. + let private normalizePath (path : string) = + let separator = string Path.DirectorySeparatorChar + Regex.Replace(path, @"\\|\/", separator) + let rec tryLoad (path : string) = match cache.TryGetValue path with | (true, result) -> @@ -37,7 +43,7 @@ module internal ProjectData = if File.Exists path then try - let xml = new XmlDocument() + let xml = XmlDocument() xml.Load path let rootDir = Path.GetDirectoryName path @@ -45,7 +51,7 @@ module internal ProjectData = let getFilePaths (xpath : string) = xml.SelectNodes xpath |> Seq.cast - |> Seq.map (fun attr -> Path.GetFullPath <| Path.Combine(rootDir, attr.Value)) + |> Seq.map (fun attr -> Path.GetFullPath <| Path.Combine(rootDir, normalizePath attr.Value)) |> Seq.toList let files = getFilePaths "//Compile/@Include"