From b8f222acf286076b8114ed4d3d66b44b0f868f74 Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 16 Apr 2019 10:57:29 -0500 Subject: [PATCH] Ensure all environment paths are created This normally happens in electron-main/main.ts but we don't run anything from there. Fixes #499. --- packages/server/src/vscode/sharedProcess.ts | 12 ------------ scripts/vscode.patch | 20 ++++++++++++++------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/packages/server/src/vscode/sharedProcess.ts b/packages/server/src/vscode/sharedProcess.ts index b2dcd4d6e..cba3519e3 100644 --- a/packages/server/src/vscode/sharedProcess.ts +++ b/packages/server/src/vscode/sharedProcess.ts @@ -1,6 +1,4 @@ import { ChildProcess } from "child_process"; -import * as fs from "fs"; -import * as fse from "fs-extra"; import * as os from "os"; import * as path from "path"; import { forkModule } from "./bootstrapFork"; @@ -90,16 +88,6 @@ export class SharedProcess { this.activeProcess.kill(); } - const backupsDir = path.join(this.userDataDir, "Backups"); - await Promise.all([ - fse.mkdirp(backupsDir), - ]); - - const workspacesFile = path.join(backupsDir, "workspaces.json"); - if (!fs.existsSync(workspacesFile)) { - fs.appendFileSync(workspacesFile, ""); - } - const activeProcess = forkModule("vs/code/electron-browser/sharedProcess/sharedProcessMain", [], { env: { VSCODE_ALLOW_IO: "true", diff --git a/scripts/vscode.patch b/scripts/vscode.patch index 1f666eac8..9f8983f01 100644 --- a/scripts/vscode.patch +++ b/scripts/vscode.patch @@ -138,17 +138,25 @@ 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..039d31a 100644 +index 6fd8249..04c0933 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts -@@ -50,0 +51 @@ 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'; -@@ -120,0 +122,3 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I ++import { mkdirp } from 'vs/base/node/pfs'; +@@ -93,0 +96,8 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I ++ Promise.all([ // Copied from src/vs/code/electron-main/main.ts ++ environmentService.extensionsPath, ++ environmentService.nodeCachedDataDir, ++ environmentService.logsPath, ++ environmentService.globalStorageHome, ++ environmentService.workspaceStorageHome, ++ environmentService.backupHome ++ ].map((path): undefined | Promise => path ? mkdirp(path) : undefined)); +@@ -119,0 +130,2 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I + const backupMainService = instantiationService.createInstance(BackupMainService) as BackupMainService; + backupMainService.initialize().catch(console.error); -+ -@@ -223,0 +228,2 @@ async function handshake(configuration: ISharedProcessConfiguration): Promise