@@ -93,7 +93,7 @@ export class EnvironmentService implements IEnvironmentService {
9393 get backupWorkspacesPath ( ) : string { return path . join ( this . backupHome , 'workspaces.json' ) ; }
9494
9595 @memoize
96- get extensionsPath ( ) : string { return path . normalize ( this . _args [ 'extensions-dir' ] || path . join ( this . userProductHome , 'extensions' ) ) ; }
96+ get extensionsPath ( ) : string { return parsePathArg ( this . _args [ 'extensions-dir' ] , process ) || path . join ( this . userProductHome , 'extensions' ) ; }
9797
9898 @memoize
9999 get extensionDevelopmentPath ( ) : string { return this . _args . extensionDevelopmentPath ? path . normalize ( this . _args . extensionDevelopmentPath ) : this . _args . extensionDevelopmentPath ; }
@@ -131,17 +131,22 @@ export function parseExtensionHostPort(args: ParsedArgs, isBuild: boolean): { po
131131 return { port, break : brk } ;
132132}
133133
134- export function parseUserDataDir ( args : ParsedArgs , process : NodeJS . Process ) {
135- const arg = args [ 'user-data-dir' ] ;
136- if ( arg ) {
137- // Determine if the arg is relative or absolute, if relative use the original CWD
138- // (VSCODE_CWD), not the potentially overridden one (process.cwd()).
139- const resolved = path . resolve ( arg ) ;
140- if ( path . normalize ( arg ) === resolved ) {
141- return resolved ;
142- } else {
143- return path . resolve ( process . env [ 'VSCODE_CWD' ] || process . cwd ( ) , arg ) ;
144- }
134+ function parsePathArg ( arg : string , process : NodeJS . Process ) : string {
135+ if ( ! arg ) {
136+ return ;
145137 }
146- return path . resolve ( paths . getDefaultUserDataPath ( process . platform ) ) ;
138+
139+ // Determine if the arg is relative or absolute, if relative use the original CWD
140+ // (VSCODE_CWD), not the potentially overridden one (process.cwd()).
141+ const resolved = path . resolve ( arg ) ;
142+
143+ if ( path . normalize ( arg ) === resolved ) {
144+ return resolved ;
145+ } else {
146+ return path . resolve ( process . env [ 'VSCODE_CWD' ] || process . cwd ( ) , arg ) ;
147+ }
148+ }
149+
150+ export function parseUserDataDir ( args : ParsedArgs , process : NodeJS . Process ) : string {
151+ return parsePathArg ( args [ 'user-data-dir' ] , process ) || path . resolve ( paths . getDefaultUserDataPath ( process . platform ) ) ;
147152}
0 commit comments