blob: 66b5ad31a3f3aa9acf9c252ed08b32869ceed648 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export function escapeNonWindowsPath(path: string): string {
let newPath = path;
if (newPath.indexOf('\\') !== 0) {
newPath = newPath.replace(/\\/g, '\\\\');
}
const bannedChars = /[\`\$\|\&\>\~\#\!\^\*\;\<\"\']/g;
newPath = newPath.replace(bannedChars, '');
return `'${newPath}'`;
}
|