Skip to content

Commit ec54e25

Browse files
Оптимизация конвертации путей
1 parent 1f0fcc5 commit ec54e25

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/VSCode.DebugAdapter/WorkspaceMapper.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private string ConvertPath(string path, Workspace fromPrefix, Workspace toPrefix
5454
return path;
5555

5656
var normalizedPath = path.Replace('\\', '/');
57-
var normalizedFrom = fromPrefix.Normalized.TrimEnd('/');
57+
var normalizedFrom = fromPrefix.Normalized;
5858

5959
var comparison = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
6060
? StringComparison.OrdinalIgnoreCase
@@ -64,9 +64,8 @@ private string ConvertPath(string path, Workspace fromPrefix, Workspace toPrefix
6464
!normalizedPath.StartsWith(normalizedFrom, comparison))
6565
return path;
6666

67-
var relativePath = normalizedPath.Substring(normalizedFrom.Length).TrimStart('/');
68-
69-
var result = toPrefix.Original.TrimEnd('/', '\\') + "/" + relativePath;
67+
var relativePath = normalizedPath.Substring(normalizedFrom.Length).TrimStart('/');
68+
var result = toPrefix.Normalized + "/" + relativePath;
7069

7170
return result;
7271
}
@@ -81,7 +80,7 @@ internal class Workspace
8180
internal Workspace(string path)
8281
{
8382
this.Original = path;
84-
this.Normalized = path.Replace('\\', '/');
83+
this.Normalized = path.Replace('\\', '/').TrimEnd('/');
8584
}
8685

8786
}

0 commit comments

Comments
 (0)