Skip to content

Commit 1bcd055

Browse files
committed
stringUtils.ts: convert backwards to forward slashes on non-Windows platforms
\\ as path separator is Windows-specific. Keep them unmodified there, otherwise normalize to forward slashes. Signed-off-by: Giancane, Francesco <fgiancan@qti.qualcomm.com>
1 parent a3d46e4 commit 1bcd055

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/extension/common/stringUtils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4+
import { getOSType, OSType } from './platform';
5+
46
/**
57
* Replaces all instances of a substring with a new substring.
68
*/
@@ -58,5 +60,10 @@ export function fileToCommandArgumentForPythonExt(source: string): string {
5860
if (!source) {
5961
return source;
6062
}
61-
return toCommandArgumentForPythonExt(source).replace(/\\/g, '/');
63+
64+
let result = toCommandArgumentForPythonExt(source);
65+
if (getOSType() !== OSType.Windows) {
66+
result = result.replace(/\\/g, '/');
67+
}
68+
return result;
6269
}

0 commit comments

Comments
 (0)