Add flags for customizing user data dir and extensions dir (#420)
* Add flags for customizing extensions directory * Update @coder/nbin
This commit is contained in:
@ -8,7 +8,7 @@ export class EnvironmentService extends environment.EnvironmentService {
|
||||
}
|
||||
|
||||
public get extensionsPath(): string {
|
||||
return path.join(paths.getAppDataPath(), "extensions");
|
||||
return paths.getExtensionsDirectory();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ class Paths {
|
||||
private _appData: string | undefined;
|
||||
private _defaultUserData: string | undefined;
|
||||
private _socketPath: string | undefined;
|
||||
private _extensionsDirectory: string | undefined;
|
||||
private _builtInExtensionsDirectory: string | undefined;
|
||||
private _workingDirectory: string | undefined;
|
||||
|
||||
@ -31,6 +32,14 @@ class Paths {
|
||||
return this._socketPath;
|
||||
}
|
||||
|
||||
public get extensionsDirectory(): string {
|
||||
if (!this._extensionsDirectory) {
|
||||
throw new Error("trying to access extensions directory before it has been set");
|
||||
}
|
||||
|
||||
return this._extensionsDirectory;
|
||||
}
|
||||
|
||||
public get builtInExtensionsDirectory(): string {
|
||||
if (!this._builtInExtensionsDirectory) {
|
||||
throw new Error("trying to access builtin extensions directory before it has been set");
|
||||
@ -52,6 +61,7 @@ class Paths {
|
||||
this._appData = data.dataDirectory;
|
||||
this._defaultUserData = data.dataDirectory;
|
||||
this._socketPath = sharedData.socketPath;
|
||||
this._extensionsDirectory = data.extensionsDirectory;
|
||||
this._builtInExtensionsDirectory = data.builtInExtensionsDirectory;
|
||||
this._workingDirectory = data.workingDirectory;
|
||||
}
|
||||
@ -61,5 +71,6 @@ 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 getExtensionsDirectory = (): string => _paths.extensionsDirectory;
|
||||
export const getBuiltInExtensionsDirectory = (): string => _paths.builtInExtensionsDirectory;
|
||||
export const getSocketPath = (): string => _paths.socketPath;
|
||||
|
Reference in New Issue
Block a user