Skip to content

Commit 8afd2a5

Browse files
CopilotJustinGrote
andauthored
Fix ToString filename extraction for Windows paths
Agent-Logs-Url: https://github.com/PowerShell/PowerShellEditorServices/sessions/6285ab7f-3d36-4174-84cd-57dcebf32386 Co-authored-by: JustinGrote <15258962+JustinGrote@users.noreply.github.com>
1 parent 9cbd9e6 commit 8afd2a5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/PowerShellEditorServices/Extensions/EditorWorkspace.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ internal EditorWorkspaceDocument(EditorWorkspace workspace, string path, bool sa
3333
/// <returns>The display name of this document.</returns>
3434
public override string ToString()
3535
{
36-
string fileName = System.IO.Path.GetFileName(Path);
36+
int fileNameStartIndex = System.Math.Max(Path.LastIndexOf('\\'), Path.LastIndexOf('/')) + 1;
37+
string fileName = Path.Substring(fileNameStartIndex);
3738
return Saved ? fileName : fileName + " [Unsaved]";
3839
}
3940

0 commit comments

Comments
 (0)