diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index 8ea3d44a286..c152ad50601 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -134,6 +134,10 @@ class CodeMain { logService.warn(`app#startup(): Error writing main lockfile: ${err.stack}`); }); + // Create logs folder now that we are the primary instance + // (https://github.com/microsoft/vscode/issues/250334) + await promises.mkdir(environmentMainService.logsHome.with({ scheme: Schemas.file }).fsPath, { recursive: true }); + // Delay creation of spdlog for perf reasons (https://github.com/microsoft/vscode/issues/72906) bufferLogger.logger = loggerService.createLogger('main', { name: localize('mainLog', "Main") }); @@ -268,10 +272,11 @@ class CodeMain { await Promises.settled([ // Environment service (paths) + // Note: logsHome is not created here to avoid creating empty log folders + // for secondary instances. It is created later after claimInstance succeeds. Promise.all([ this.allowWindowsUNCPath(environmentMainService.extensionsPath), // enable extension paths on UNC drives... environmentMainService.codeCachePath, // ...other user-data-derived paths should already be enlisted from `main.js` - environmentMainService.logsHome.with({ scheme: Schemas.file }).fsPath, userDataProfilesMainService.defaultProfile.globalStorageHome.with({ scheme: Schemas.file }).fsPath, environmentMainService.workspaceStorageHome.with({ scheme: Schemas.file }).fsPath, environmentMainService.localHistoryHome.with({ scheme: Schemas.file }).fsPath,