Skip to content

Commit 8188556

Browse files
committed
Make sure directories exist
Fixes #3040.
1 parent 2dcf098 commit 8188556

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/vscode/src/vs/server/node/server.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as fs from 'fs';
1+
import { promises as fs } from 'fs';
22
import * as net from 'net';
33
import { hostname, release } from 'os';
44
import * as path from 'path';
@@ -213,8 +213,16 @@ export class Vscode {
213213
private async initializeServices(args: NativeParsedArgs): Promise<void> {
214214
const productService = { _serviceBrand: undefined, ...product };
215215
const environmentService = new NativeEnvironmentService(args, productService);
216-
// https://github.com/cdr/code-server/issues/1693
217-
fs.mkdirSync(environmentService.globalStorageHome.fsPath, { recursive: true });
216+
217+
await Promise.all([
218+
environmentService.extensionsPath,
219+
environmentService.logsPath,
220+
environmentService.globalStorageHome.fsPath,
221+
environmentService.workspaceStorageHome.fsPath,
222+
].map((p) => fs.mkdir(p, { recursive: true }).catch((error) => {
223+
logger.warn(error.message || error);
224+
})));
225+
218226
const logService = new MultiplexLogService([
219227
new ConsoleLogger(getLogLevel(environmentService)),
220228
new SpdLogLogger(RemoteExtensionLogFileName, path.join(environmentService.logsPath, `${RemoteExtensionLogFileName}.log`), false, getLogLevel(environmentService))

0 commit comments

Comments
 (0)