Ensure all environment paths are created

This normally happens in electron-main/main.ts but we don't run anything
from there.

Fixes #499.
This commit is contained in:
Asher 2019-04-16 10:57:29 -05:00
parent aabb2ecda7
commit b8f222acf2
No known key found for this signature in database
GPG Key ID: 7BB4BA9C783D2BBC
2 changed files with 14 additions and 18 deletions

View File

@ -1,6 +1,4 @@
import { ChildProcess } from "child_process"; import { ChildProcess } from "child_process";
import * as fs from "fs";
import * as fse from "fs-extra";
import * as os from "os"; import * as os from "os";
import * as path from "path"; import * as path from "path";
import { forkModule } from "./bootstrapFork"; import { forkModule } from "./bootstrapFork";
@ -90,16 +88,6 @@ export class SharedProcess {
this.activeProcess.kill(); 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", [], { const activeProcess = forkModule("vs/code/electron-browser/sharedProcess/sharedProcessMain", [], {
env: { env: {
VSCODE_ALLOW_IO: "true", VSCODE_ALLOW_IO: "true",

View File

@ -138,17 +138,25 @@ 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..039d31a 100644 index 6fd8249..04c0933 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 @@ 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';
@@ -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<boolean | undefined>([ // 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<boolean> => path ? mkdirp(path) : undefined));
@@ -119,0 +130,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);
+ @@ -223,0 +236 @@ async function handshake(configuration: ISharedProcessConfiguration): Promise<vo
@@ -223,0 +228,2 @@ async function handshake(configuration: ISharedProcessConfiguration): Promise<vo
+
+startup({ machineId: "1" }); +startup({ machineId: "1" });
diff --git a/src/vs/editor/browser/config/configuration.ts b/src/vs/editor/browser/config/configuration.ts diff --git a/src/vs/editor/browser/config/configuration.ts b/src/vs/editor/browser/config/configuration.ts
index f97a692..0206957 100644 index f97a692..0206957 100644