Skip to content

Commit

Permalink
Make sure directories exist
Browse files Browse the repository at this point in the history
Fixes #3040.
  • Loading branch information
code-asher committed May 7, 2021
1 parent 2dcf098 commit 8188556
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/vscode/src/vs/server/node/server.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -213,8 +213,16 @@ 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,
].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))
Expand Down

0 comments on commit 8188556

Please sign in to comment.