Make sure directories exist

Fixes #3040.
This commit is contained in:
Asher 2021-05-07 11:34:39 -05:00
parent b21a9af473
commit 9ff29d17fb
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -1,4 +1,4 @@
import * as fs from 'fs';
import { promises as fs } from 'fs';
import * as net from 'net';
import { hostname, release } from 'os';
import * as path from 'path';
@ -213,8 +213,18 @@ export class Vscode {
private async initializeServices(args: NativeParsedArgs): Promise<void> {
const productService = { _serviceBrand: undefined, ...product };
const environmentService = new NativeEnvironmentService(args, productService);
// https://github.com/cdr/code-server/issues/1693
fs.mkdirSync(environmentService.globalStorageHome.fsPath, { recursive: true });
await Promise.all([
environmentService.extensionsPath,
environmentService.logsPath,
environmentService.globalStorageHome.fsPath,
environmentService.workspaceStorageHome.fsPath,
...environmentService.extraExtensionPaths,
...environmentService.extraBuiltinExtensionPaths,
].map((p) => fs.mkdir(p, { recursive: true }).catch((error) => {
logger.warn(error.message || error);
})));
const logService = new MultiplexLogService([
new ConsoleLogger(getLogLevel(environmentService)),
new SpdLogLogger(RemoteExtensionLogFileName, path.join(environmentService.logsPath, `${RemoteExtensionLogFileName}.log`), false, getLogLevel(environmentService))