26
*/
27
export function getUserDataPath(cliArgs: NativeParsedArgs, productName: string): string {
28
>
const userDataPath = doGetUserDataPath(cliArgs, productName);
userDataPath.ts
29
>
const pathsToResolve = [userDataPath];
30
>
31
>
// If the user-data-path is not absolute, make
32
>
// sure to resolve it against the passed in
33
>
// current working directory. We cannot use the
34
>
// node.js `path.resolve()` logic because it will
35
>
// not pick up our `VSCODE_CWD` environment variable
36
>
// (https://github.com/microsoft/vscode/issues/120269)
37
>
if (!isAbsolute(userDataPath)) {
38
pathsToResolve.unshift(cwd);
39
}
41
>
return resolve(...pathsToResolve);
42
>
}
43
44
>
function doGetUserDataPath(cliArgs: NativeParsedArgs, productName: string): string {
userDataPath.ts
45
>
46
>
// 0. Running out of sources has a fixed productName
47
>
if (process.env['VSCODE_DEV']) {
48
productName = 'code-oss-dev';
49
}
51
>
// 1. Support portable mode
52
>
const portablePath = process.env['VSCODE_PORTABLE'];
53
>
if (portablePath) {
54
return join(portablePath, 'user-data');
55
}