@@ -21,6 +21,7 @@ import { needToken } from "./api/utils";
21
21
import { startWorkspaceIfStoppedOrFailed , waitForBuild } from "./api/workspace" ;
22
22
import * as cli from "./cliManager" ;
23
23
import { Commands } from "./commands" ;
24
+ import { PathResolver } from "./core/pathResolver" ;
24
25
import { featureSetForVersion , FeatureSet } from "./featureSet" ;
25
26
import { getGlobalFlags } from "./globalFlags" ;
26
27
import { Inbox } from "./inbox" ;
@@ -48,6 +49,7 @@ export class Remote {
48
49
private readonly storage : Storage ,
49
50
private readonly commands : Commands ,
50
51
private readonly mode : vscode . ExtensionMode ,
52
+ private readonly pathResolver : PathResolver ,
51
53
) { }
52
54
53
55
private async confirmStart ( workspaceName : string ) : Promise < boolean > {
@@ -111,9 +113,7 @@ export class Remote {
111
113
title : "Waiting for workspace build..." ,
112
114
} ,
113
115
async ( ) => {
114
- const globalConfigDir = path . dirname (
115
- this . storage . getSessionTokenPath ( label ) ,
116
- ) ;
116
+ const globalConfigDir = this . pathResolver . getGlobalConfigDir ( label ) ;
117
117
while ( workspace . latest_build . status !== "running" ) {
118
118
++ attempts ;
119
119
switch ( workspace . latest_build . status ) {
@@ -437,7 +437,7 @@ export class Remote {
437
437
let settingsContent = "{}" ;
438
438
try {
439
439
settingsContent = await fs . readFile (
440
- this . storage . getUserSettingsPath ( ) ,
440
+ this . pathResolver . getUserSettingsPath ( ) ,
441
441
"utf8" ,
442
442
) ;
443
443
} catch ( ex ) {
@@ -486,7 +486,10 @@ export class Remote {
486
486
487
487
if ( mungedPlatforms || mungedConnTimeout ) {
488
488
try {
489
- await fs . writeFile ( this . storage . getUserSettingsPath ( ) , settingsContent ) ;
489
+ await fs . writeFile (
490
+ this . pathResolver . getUserSettingsPath ( ) ,
491
+ settingsContent ,
492
+ ) ;
490
493
} catch ( ex ) {
491
494
// This could be because the user's settings.json is read-only. This is
492
495
// the case when using home-manager on NixOS, for example. Failure to
@@ -765,11 +768,11 @@ export class Remote {
765
768
const globalConfigs = this . globalConfigs ( label ) ;
766
769
767
770
const proxyCommand = featureSet . wildcardSSH
768
- ? `${ escapeCommandArg ( binaryPath ) } ${ globalConfigs } ssh --stdio --usage-app=vscode --disable-autostart --network-info-dir ${ escapeCommandArg ( this . storage . getNetworkInfoPath ( ) ) } ${ await this . formatLogArg ( logDir ) } --ssh-host-prefix ${ hostPrefix } %h`
771
+ ? `${ escapeCommandArg ( binaryPath ) } ${ globalConfigs } ssh --stdio --usage-app=vscode --disable-autostart --network-info-dir ${ escapeCommandArg ( this . pathResolver . getNetworkInfoPath ( ) ) } ${ await this . formatLogArg ( logDir ) } --ssh-host-prefix ${ hostPrefix } %h`
769
772
: `${ escapeCommandArg ( binaryPath ) } ${ globalConfigs } vscodessh --network-info-dir ${ escapeCommandArg (
770
- this . storage . getNetworkInfoPath ( ) ,
771
- ) } ${ await this . formatLogArg ( logDir ) } --session-token-file ${ escapeCommandArg ( this . storage . getSessionTokenPath ( label ) ) } --url-file ${ escapeCommandArg (
772
- this . storage . getUrlPath ( label ) ,
773
+ this . pathResolver . getNetworkInfoPath ( ) ,
774
+ ) } ${ await this . formatLogArg ( logDir ) } --session-token-file ${ escapeCommandArg ( this . pathResolver . getSessionTokenPath ( label ) ) } --url-file ${ escapeCommandArg (
775
+ this . pathResolver . getUrlPath ( label ) ,
773
776
) } %h`;
774
777
775
778
const sshValues : SSHValues = {
@@ -828,7 +831,7 @@ export class Remote {
828
831
const vscodeConfig = vscode . workspace . getConfiguration ( ) ;
829
832
const args = getGlobalFlags (
830
833
vscodeConfig ,
831
- path . dirname ( this . storage . getSessionTokenPath ( label ) ) ,
834
+ this . pathResolver . getGlobalConfigDir ( label ) ,
832
835
) ;
833
836
return ` ${ args . join ( " " ) } ` ;
834
837
}
@@ -841,7 +844,7 @@ export class Remote {
841
844
1000 ,
842
845
) ;
843
846
const networkInfoFile = path . join (
844
- this . storage . getNetworkInfoPath ( ) ,
847
+ this . pathResolver . getNetworkInfoPath ( ) ,
845
848
`${ sshPid } .json` ,
846
849
) ;
847
850
0 commit comments