Skip to content

Commit c9609bd

Browse files
author
Benjamin Pasero
committed
add userHomeSync (for microsoft#94506)
1 parent 5a83a62 commit c9609bd

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

src/vs/workbench/services/path/common/remotePathService.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,29 @@ const REMOTE_PATH_SERVICE_ID = 'remotePath';
1515
export const IRemotePathService = createDecorator<IRemotePathService>(REMOTE_PATH_SERVICE_ID);
1616

1717
export interface IRemotePathService {
18+
1819
_serviceBrand: undefined;
1920

21+
/**
22+
* The path library to use for the target remote environment.
23+
*/
2024
readonly path: Promise<path.IPath>;
25+
26+
/**
27+
* Converts the given path to a file URI in the remote environment.
28+
*/
2129
fileURI(path: string): Promise<URI>;
2230

31+
/**
32+
* Resolves the user home of the remote environment if defined.
33+
*/
2334
readonly userHome: Promise<URI>;
35+
36+
/**
37+
* Provides access to the user home of the remote environment
38+
* if defined.
39+
*/
40+
readonly userHomeSync: URI | undefined;
2441
}
2542

2643
/**
@@ -30,12 +47,15 @@ export class RemotePathService implements IRemotePathService {
3047
_serviceBrand: undefined;
3148

3249
private _extHostOS: Promise<platform.OperatingSystem>;
50+
private _userHomeSync: URI | undefined;
3351

3452
constructor(
3553
@IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService,
3654
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService
3755
) {
3856
this._extHostOS = remoteAgentService.getEnvironment().then(remoteEnvironment => {
57+
this._userHomeSync = remoteEnvironment?.userHome;
58+
3959
return remoteEnvironment ? remoteEnvironment.os : platform.OS;
4060
});
4161
}
@@ -93,6 +113,10 @@ export class RemotePathService implements IRemotePathService {
93113
return this.environmentService.userHome!;
94114
});
95115
}
116+
117+
get userHomeSync(): URI | undefined {
118+
return this._userHomeSync || this.environmentService.userHome;
119+
}
96120
}
97121

98122
registerSingleton(IRemotePathService, RemotePathService, true);

src/vs/workbench/test/browser/workbenchTestServices.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,7 @@ export class TestRemotePathService implements IRemotePathService {
11101110
get path() { return Promise.resolve(isWindows ? win32 : posix); }
11111111

11121112
get userHome() { return Promise.resolve(this.environmentService.userHome!); }
1113+
get userHomeSync() { return this.environmentService.userHome; }
11131114

11141115
async fileURI(path: string): Promise<URI> {
11151116
return URI.file(path);

0 commit comments

Comments
 (0)