mirror of https://github.com/coder/code-server.git
Don't try to create builtin extensions directory
Since this will be a path in the binary that we don't want to create on the user's system. I also removed the option to override it; it doesn't seem like a great idea since you'd always want those builtin extensions. This way we also don't have to check if the option was passed and only create it if that was the case.
This commit is contained in:
parent
81bbfa7fbe
commit
c020cd2f2c
|
@ -26,7 +26,6 @@ commander.version(process.env.VERSION || "development")
|
||||||
.option("--cert <value>")
|
.option("--cert <value>")
|
||||||
.option("--cert-key <value>")
|
.option("--cert-key <value>")
|
||||||
.option("-e, --extensions-dir <dir>", "Override the main default path for user extensions.")
|
.option("-e, --extensions-dir <dir>", "Override the main default path for user extensions.")
|
||||||
.option("--builtin-extensions-dir <dir>", "Override the main default path for built-in extensions.")
|
|
||||||
.option("--extra-extensions-dir [dir]", "Path to an extra user extension directory (repeatable).", collect, [])
|
.option("--extra-extensions-dir [dir]", "Path to an extra user extension directory (repeatable).", collect, [])
|
||||||
.option("--extra-builtin-extensions-dir [dir]", "Path to an extra built-in extension directory (repeatable).", collect, [])
|
.option("--extra-builtin-extensions-dir [dir]", "Path to an extra built-in extension directory (repeatable).", collect, [])
|
||||||
.option("-d --user-data-dir <dir>", "Specifies the directory that user data is kept in, useful when running as root.")
|
.option("-d --user-data-dir <dir>", "Specifies the directory that user data is kept in, useful when running as root.")
|
||||||
|
@ -66,7 +65,6 @@ const bold = (text: string | number): string | number => {
|
||||||
|
|
||||||
readonly userDataDir?: string;
|
readonly userDataDir?: string;
|
||||||
readonly extensionsDir?: string;
|
readonly extensionsDir?: string;
|
||||||
readonly builtinExtensionsDir?: string;
|
|
||||||
readonly extraExtensionsDir?: string[];
|
readonly extraExtensionsDir?: string[];
|
||||||
readonly extraBuiltinExtensionsDir?: string[];
|
readonly extraBuiltinExtensionsDir?: string[];
|
||||||
|
|
||||||
|
@ -94,8 +92,7 @@ const bold = (text: string | number): string | number => {
|
||||||
|
|
||||||
const dataDir = path.resolve(options.userDataDir || options.dataDir || path.join(dataHome, "code-server"));
|
const dataDir = path.resolve(options.userDataDir || options.dataDir || path.join(dataHome, "code-server"));
|
||||||
const extensionsDir = options.extensionsDir ? path.resolve(options.extensionsDir) : path.resolve(dataDir, "extensions");
|
const extensionsDir = options.extensionsDir ? path.resolve(options.extensionsDir) : path.resolve(dataDir, "extensions");
|
||||||
const builtInExtensionsDir = options.builtinExtensionsDir ? path.resolve(options.builtinExtensionsDir)
|
const builtInExtensionsDir = path.resolve(buildDir || path.join(__dirname, ".."), "build/extensions");
|
||||||
: path.resolve(buildDir || path.join(__dirname, ".."), "build/extensions");
|
|
||||||
const extraExtensionDirs = options.extraExtensionsDir ? options.extraExtensionsDir.map((p) => path.resolve(p)) : [];
|
const extraExtensionDirs = options.extraExtensionsDir ? options.extraExtensionsDir.map((p) => path.resolve(p)) : [];
|
||||||
const extraBuiltinExtensionDirs = options.extraBuiltinExtensionsDir ? options.extraBuiltinExtensionsDir.map((p) => path.resolve(p)) : [];
|
const extraBuiltinExtensionDirs = options.extraBuiltinExtensionsDir ? options.extraBuiltinExtensionsDir.map((p) => path.resolve(p)) : [];
|
||||||
const workingDir = path.resolve(args[0] || process.cwd());
|
const workingDir = path.resolve(args[0] || process.cwd());
|
||||||
|
@ -113,7 +110,6 @@ const bold = (text: string | number): string | number => {
|
||||||
fse.mkdirp(cacheHome),
|
fse.mkdirp(cacheHome),
|
||||||
fse.mkdirp(dataDir),
|
fse.mkdirp(dataDir),
|
||||||
fse.mkdirp(extensionsDir),
|
fse.mkdirp(extensionsDir),
|
||||||
fse.mkdirp(builtInExtensionsDir),
|
|
||||||
fse.mkdirp(workingDir),
|
fse.mkdirp(workingDir),
|
||||||
fse.mkdirp(dependenciesDir),
|
fse.mkdirp(dependenciesDir),
|
||||||
...extraExtensionDirs.map((p) => fse.mkdirp(p)),
|
...extraExtensionDirs.map((p) => fse.mkdirp(p)),
|
||||||
|
|
|
@ -149,13 +149,13 @@ index e0ff793..885de12 100644
|
||||||
- const cmdOrCtrlKey = platform.isMacintosh ? e.metaKey : e.ctrlKey;
|
- const cmdOrCtrlKey = platform.isMacintosh ? e.metaKey : e.ctrlKey;
|
||||||
+ const cmdOrCtrlKey = browser.isMacintosh ? e.metaKey : e.ctrlKey;
|
+ const cmdOrCtrlKey = browser.isMacintosh ? e.metaKey : e.ctrlKey;
|
||||||
diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
|
diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
|
||||||
index 6fd8249..1101558 100644
|
index 6fd8249..6ae6b11 100644
|
||||||
--- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
|
--- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
|
||||||
+++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
|
+++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
|
||||||
@@ -50,0 +51,2 @@ import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiatio
|
@@ -50,0 +51,2 @@ import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiatio
|
||||||
+import { BackupMainService } from 'vs/platform/backup/electron-main/backupMainService';
|
+import { BackupMainService } from 'vs/platform/backup/electron-main/backupMainService';
|
||||||
+import { mkdirp } from 'vs/base/node/pfs';
|
+import { mkdirp } from 'vs/base/node/pfs';
|
||||||
@@ -93,0 +96,11 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
|
@@ -93,0 +96,10 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
|
||||||
+ Promise.all<boolean | undefined>([ // Copied from src/vs/code/electron-main/main.ts
|
+ Promise.all<boolean | undefined>([ // Copied from src/vs/code/electron-main/main.ts
|
||||||
+ environmentService.extensionsPath,
|
+ environmentService.extensionsPath,
|
||||||
+ environmentService.nodeCachedDataDir,
|
+ environmentService.nodeCachedDataDir,
|
||||||
|
@ -163,20 +163,19 @@ index 6fd8249..1101558 100644
|
||||||
+ environmentService.globalStorageHome,
|
+ environmentService.globalStorageHome,
|
||||||
+ environmentService.workspaceStorageHome,
|
+ environmentService.workspaceStorageHome,
|
||||||
+ environmentService.backupHome,
|
+ environmentService.backupHome,
|
||||||
+ environmentService.builtinExtensionsPath,
|
|
||||||
+ ...environmentService.extraExtensionPaths,
|
+ ...environmentService.extraExtensionPaths,
|
||||||
+ ...environmentService.extraBuiltinExtensionPaths,
|
+ ...environmentService.extraBuiltinExtensionPaths,
|
||||||
+ ].map((path): undefined | Promise<boolean> => path ? mkdirp(path) : undefined));
|
+ ].map((path): undefined | Promise<boolean> => path ? mkdirp(path) : undefined));
|
||||||
@@ -119,0 +133,2 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
|
@@ -119,0 +132,2 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
|
||||||
+ const backupMainService = instantiationService.createInstance(BackupMainService) as BackupMainService;
|
+ const backupMainService = instantiationService.createInstance(BackupMainService) as BackupMainService;
|
||||||
+ backupMainService.initialize().catch(console.error);
|
+ backupMainService.initialize().catch(console.error);
|
||||||
@@ -124 +139 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
|
@@ -124 +138 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
|
||||||
- const { appRoot, extensionsPath, extensionDevelopmentLocationURI, isBuilt, installSourcePath } = environmentService;
|
- const { appRoot, extensionsPath, extensionDevelopmentLocationURI, isBuilt, installSourcePath } = environmentService;
|
||||||
+ const { appRoot, extensionsPath, extraExtensionPaths, extensionDevelopmentLocationURI, isBuilt, installSourcePath } = environmentService;
|
+ const { appRoot, extensionsPath, extraExtensionPaths, extensionDevelopmentLocationURI, isBuilt, installSourcePath } = environmentService;
|
||||||
@@ -138 +153 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
|
@@ -138 +152 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
|
||||||
- piiPaths: [appRoot, extensionsPath]
|
- piiPaths: [appRoot, extensionsPath]
|
||||||
+ piiPaths: [appRoot, extensionsPath, ...extraExtensionPaths]
|
+ piiPaths: [appRoot, extensionsPath, ...extraExtensionPaths]
|
||||||
@@ -223,0 +239 @@ async function handshake(configuration: ISharedProcessConfiguration): Promise<vo
|
@@ -223,0 +238 @@ async function handshake(configuration: ISharedProcessConfiguration): Promise<vo
|
||||||
+startup({ machineId: "1" });
|
+startup({ machineId: "1" });
|
||||||
diff --git a/src/vs/code/node/cli.ts b/src/vs/code/node/cli.ts
|
diff --git a/src/vs/code/node/cli.ts b/src/vs/code/node/cli.ts
|
||||||
index 1f8b17a..2a875f9 100644
|
index 1f8b17a..2a875f9 100644
|
||||||
|
|
Loading…
Reference in New Issue