sussudio
Version:
An unofficial VS Code Internal API
22 lines (21 loc) • 1.21 kB
text/typescript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Aggressively escape non-windows paths to prepare for being sent to a shell. This will do some
* escaping inaccurately to be careful about possible script injection via the file path. For
* example, we're trying to prevent this sort of attack: `/foo/file$(echo evil)`.
*/
export declare function escapeNonWindowsPath(path: string): string;
/**
* Collapses the user's home directory into `~` if it exists within the path, this gives a shorter
* path that is more suitable within the context of a terminal.
*/
export declare function collapseTildePath(path: string | undefined, userHome: string | undefined, separator: string): string;
/**
* Sanitizes a cwd string, removing any wrapping quotes and making the Windows drive letter
* uppercase.
* @param cwd The directory to sanitize.
*/
export declare function sanitizeCwd(cwd: string): string;