From c020cd2f2c14cf8b3c0fdd4c69ced1cbf64acb48 Mon Sep 17 00:00:00 2001 From: Asher Date: Sun, 19 May 2019 19:49:05 -0500 Subject: [PATCH] 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. --- packages/server/src/cli.ts | 6 +----- scripts/vscode.patch | 13 ++++++------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/server/src/cli.ts b/packages/server/src/cli.ts index 4cc8291af..629a961d9 100644 --- a/packages/server/src/cli.ts +++ b/packages/server/src/cli.ts @@ -26,7 +26,6 @@ commander.version(process.env.VERSION || "development") .option("--cert ") .option("--cert-key ") .option("-e, --extensions-dir ", "Override the main default path for user extensions.") - .option("--builtin-extensions-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-builtin-extensions-dir [dir]", "Path to an extra built-in extension directory (repeatable).", collect, []) .option("-d --user-data-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 extensionsDir?: string; - readonly builtinExtensionsDir?: string; readonly extraExtensionsDir?: 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 extensionsDir = options.extensionsDir ? path.resolve(options.extensionsDir) : path.resolve(dataDir, "extensions"); - const builtInExtensionsDir = options.builtinExtensionsDir ? path.resolve(options.builtinExtensionsDir) - : path.resolve(buildDir || path.join(__dirname, ".."), "build/extensions"); + const builtInExtensionsDir = path.resolve(buildDir || path.join(__dirname, ".."), "build/extensions"); const extraExtensionDirs = options.extraExtensionsDir ? options.extraExtensionsDir.map((p) => path.resolve(p)) : []; const extraBuiltinExtensionDirs = options.extraBuiltinExtensionsDir ? options.extraBuiltinExtensionsDir.map((p) => path.resolve(p)) : []; const workingDir = path.resolve(args[0] || process.cwd()); @@ -113,7 +110,6 @@ const bold = (text: string | number): string | number => { fse.mkdirp(cacheHome), fse.mkdirp(dataDir), fse.mkdirp(extensionsDir), - fse.mkdirp(builtInExtensionsDir), fse.mkdirp(workingDir), fse.mkdirp(dependenciesDir), ...extraExtensionDirs.map((p) => fse.mkdirp(p)), diff --git a/scripts/vscode.patch b/scripts/vscode.patch index bba7c2fb6..90ba05551 100644 --- a/scripts/vscode.patch +++ b/scripts/vscode.patch @@ -149,13 +149,13 @@ index e0ff793..885de12 100644 - const cmdOrCtrlKey = platform.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 -index 6fd8249..1101558 100644 +index 6fd8249..6ae6b11 100644 --- a/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 +import { BackupMainService } from 'vs/platform/backup/electron-main/backupMainService'; +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([ // Copied from src/vs/code/electron-main/main.ts + environmentService.extensionsPath, + environmentService.nodeCachedDataDir, @@ -163,20 +163,19 @@ index 6fd8249..1101558 100644 + environmentService.globalStorageHome, + environmentService.workspaceStorageHome, + environmentService.backupHome, -+ environmentService.builtinExtensionsPath, + ...environmentService.extraExtensionPaths, + ...environmentService.extraBuiltinExtensionPaths, + ].map((path): undefined | Promise => 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; + 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, 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, ...extraExtensionPaths] -@@ -223,0 +239 @@ async function handshake(configuration: ISharedProcessConfiguration): Promise