mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
add userHomeSync (for #94506)
This commit is contained in:
@@ -15,12 +15,29 @@ const REMOTE_PATH_SERVICE_ID = 'remotePath';
|
||||
export const IRemotePathService = createDecorator<IRemotePathService>(REMOTE_PATH_SERVICE_ID);
|
||||
|
||||
export interface IRemotePathService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
/**
|
||||
* The path library to use for the target remote environment.
|
||||
*/
|
||||
readonly path: Promise<path.IPath>;
|
||||
|
||||
/**
|
||||
* Converts the given path to a file URI in the remote environment.
|
||||
*/
|
||||
fileURI(path: string): Promise<URI>;
|
||||
|
||||
/**
|
||||
* Resolves the user home of the remote environment if defined.
|
||||
*/
|
||||
readonly userHome: Promise<URI>;
|
||||
|
||||
/**
|
||||
* Provides access to the user home of the remote environment
|
||||
* if defined.
|
||||
*/
|
||||
readonly userHomeSync: URI | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,12 +47,15 @@ export class RemotePathService implements IRemotePathService {
|
||||
_serviceBrand: undefined;
|
||||
|
||||
private _extHostOS: Promise<platform.OperatingSystem>;
|
||||
private _userHomeSync: URI | undefined;
|
||||
|
||||
constructor(
|
||||
@IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService,
|
||||
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService
|
||||
) {
|
||||
this._extHostOS = remoteAgentService.getEnvironment().then(remoteEnvironment => {
|
||||
this._userHomeSync = remoteEnvironment?.userHome;
|
||||
|
||||
return remoteEnvironment ? remoteEnvironment.os : platform.OS;
|
||||
});
|
||||
}
|
||||
@@ -93,6 +113,10 @@ export class RemotePathService implements IRemotePathService {
|
||||
return this.environmentService.userHome!;
|
||||
});
|
||||
}
|
||||
|
||||
get userHomeSync(): URI | undefined {
|
||||
return this._userHomeSync || this.environmentService.userHome;
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IRemotePathService, RemotePathService, true);
|
||||
|
||||
Reference in New Issue
Block a user