Skip to content

Commit 48db084

Browse files
committed
Fixed typo in EscapedWilcardsInPath and moved static method to PowerShellContext.
1 parent da2d9f0 commit 48db084

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/PowerShellEditorServices/Debugging/DebugService.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,6 @@ public DebugService(PowerShellContext powerShellContext)
5656

5757
#region Public Methods
5858

59-
/// <summary>
60-
/// Returns the passed in path with the [ and ] wildcard characters escaped.
61-
/// </summary>
62-
/// <param name="path">The path to process.</param>
63-
/// <returns>The path with [ and ] escaped.</returns>
64-
public static string EscapeWilcardsInPath(string path)
65-
{
66-
return path.Replace("[", "`[").Replace("]", "`]");
67-
}
68-
6959
/// <summary>
7060
/// Sets the list of breakpoints for the current debugging session.
7161
/// </summary>
@@ -89,7 +79,7 @@ public async Task<BreakpointDetails[]> SetBreakpoints(
8979
{
9080
// Fix for issue #123 - file paths that contain wildcard chars [ and ] need to
9181
// quoted and have those wildcard chars escaped.
92-
string escapedScriptPath = EscapeWilcardsInPath(scriptFile.FilePath);
82+
string escapedScriptPath = PowerShellContext.EscapeWildcardsInPath(scriptFile.FilePath);
9383

9484
PSCommand psCommand = new PSCommand();
9585
psCommand.AddCommand("Set-PSBreakpoint");

src/PowerShellEditorServices/Session/PowerShellContext.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ public async Task ExecuteScriptAtPath(string scriptPath)
438438
// If we don't escape wildcard characters in the script path, the script can
439439
// fail to execute if say the script name was foo][.ps1.
440440
// Related to issue #123.
441-
string escapedScriptPath = DebugService.EscapeWilcardsInPath(scriptPath);
441+
string escapedScriptPath = EscapeWildcardsInPath(scriptPath);
442442

443443
PSCommand command = new PSCommand();
444444
command.AddCommand(escapedScriptPath);
@@ -552,6 +552,16 @@ internal void ReleaseRunspaceHandle(RunspaceHandle runspaceHandle)
552552
}
553553
}
554554

555+
/// <summary>
556+
/// Returns the passed in path with the [ and ] wildcard characters escaped.
557+
/// </summary>
558+
/// <param name="path">The path to process.</param>
559+
/// <returns>The path with [ and ] escaped.</returns>
560+
internal static string EscapeWildcardsInPath(string path)
561+
{
562+
return path.Replace("[", "`[").Replace("]", "`]");
563+
}
564+
555565
#endregion
556566

557567
#region Events

0 commit comments

Comments
 (0)