mirror of
https://github.com/coder/code-server.git
synced 2026-05-30 08:59:32 +00:00
Set platform based on server (#32)
* Set platform based on server Had to refactor a bit to ensure our values get set before VS Code tries to use them. * Pave the way for mnemonics on all platforms * Fix context menus on Mac * Fix a bunch of things on Mac including menu bar * Set keybindings based on client's OS
This commit is contained in:
@@ -4,6 +4,8 @@ class Paths {
|
||||
private _appData: string | undefined;
|
||||
private _defaultUserData: string | undefined;
|
||||
private _socketPath: string | undefined;
|
||||
private _builtInExtensionsDirectory: string | undefined;
|
||||
private _workingDirectory: string | undefined;
|
||||
|
||||
public get appData(): string {
|
||||
if (typeof this._appData === "undefined") {
|
||||
@@ -29,14 +31,35 @@ class Paths {
|
||||
return this._socketPath;
|
||||
}
|
||||
|
||||
public get builtInExtensionsDirectory(): string {
|
||||
if (!this._builtInExtensionsDirectory) {
|
||||
throw new Error("trying to access builtin extensions directory before it has been set");
|
||||
}
|
||||
|
||||
return this._builtInExtensionsDirectory;
|
||||
}
|
||||
|
||||
public get workingDirectory(): string {
|
||||
if (!this._workingDirectory) {
|
||||
throw new Error("trying to access working directory before it has been set");
|
||||
}
|
||||
|
||||
return this._workingDirectory;
|
||||
}
|
||||
|
||||
public initialize(data: InitData, sharedData: SharedProcessData): void {
|
||||
process.env.VSCODE_LOGS = sharedData.logPath;
|
||||
this._appData = data.dataDirectory;
|
||||
this._defaultUserData = data.dataDirectory;
|
||||
this._socketPath = sharedData.socketPath;
|
||||
this._builtInExtensionsDirectory = data.builtInExtensionsDirectory;
|
||||
this._workingDirectory = data.workingDirectory;
|
||||
}
|
||||
}
|
||||
|
||||
export const _paths = new Paths();
|
||||
export const getAppDataPath = (): string => _paths.appData;
|
||||
export const getDefaultUserDataPath = (): string => _paths.defaultUserData;
|
||||
export const getWorkingDirectory = (): string => _paths.workingDirectory;
|
||||
export const getBuiltInExtensionsDirectory = (): string => _paths.builtInExtensionsDirectory;
|
||||
export const getSocketPath = (): string => _paths.socketPath;
|
||||
|
||||
Reference in New Issue
Block a user