From 31ee04cff0670588c4a4005872df28c0732f274d Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Sat, 19 Oct 2024 02:34:47 +0200 Subject: [PATCH 1/2] fix: correctly read user's product.json --- patches/merge-user-product.patch | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/patches/merge-user-product.patch b/patches/merge-user-product.patch index 636b24851b2..848a093928a 100644 --- a/patches/merge-user-product.patch +++ b/patches/merge-user-product.patch @@ -1,5 +1,5 @@ diff --git a/src/main.ts b/src/main.ts -index 62ddd5f..90c6cfd 100644 +index 62ddd5f..7c21b8f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,2 +8,3 @@ import * as fs from 'original-fs'; @@ -10,15 +10,16 @@ index 62ddd5f..90c6cfd 100644 const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const require = createRequire(import.meta.url); -@@ -103,2 +105,13 @@ registerListeners(); +@@ -103,2 +105,14 @@ registerListeners(); +function resolveUserProduct() { -+ const userProductPath = `file:///${userDataPath}/product.json`; ++ const userProductPath = path.join(userDataPath, 'product.json'); + + try { + // Assign the product configuration to the global scope -+ const productPath = require(fileURLToPath(userProductPath)); -+ globalThis._VSCODE_PRODUCT_JSON = productPath; ++ const productJson = require(userProductPath); ++ // @ts-expect-error ++ globalThis._VSCODE_USER_PRODUCT_JSON = productJson; + } catch (ex) { + } +} From 8cd06a5457ec4f115ca1e6dcbba2cc5f0e3c1093 Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Sat, 19 Oct 2024 02:55:01 +0200 Subject: [PATCH 2/2] feat: update patches --- insider.json | 2 +- patches/crash-reporter.patch | 8 ++++++-- patches/merge-user-product.patch | 10 +++++----- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/insider.json b/insider.json index 553d16db437..4462c03907b 100644 --- a/insider.json +++ b/insider.json @@ -1,4 +1,4 @@ { "tag": "1.95.0", - "commit": "a016ec9b66ffdd3ff0f831768b8e75be008a54e4" + "commit": "c85acdad6b679973c79b01a38afa91448c705c1c" } diff --git a/patches/crash-reporter.patch b/patches/crash-reporter.patch index 8c9a786630c..c187bf93d31 100644 --- a/patches/crash-reporter.patch +++ b/patches/crash-reporter.patch @@ -1,10 +1,14 @@ diff --git a/src/main.ts b/src/main.ts -index 62ddd5f..a6fc3c5 100644 +index ff9a5e8..6fb7fd2 100644 --- a/src/main.ts +++ b/src/main.ts -@@ -461,2 +461,5 @@ function configureCrashReporter(): void { +@@ -467,6 +467,9 @@ function configureCrashReporter(): void { + } + } } + else { + return; + } } + + // Start crash reporter for all processes diff --git a/patches/merge-user-product.patch b/patches/merge-user-product.patch index 848a093928a..652d86dc72d 100644 --- a/patches/merge-user-product.patch +++ b/patches/merge-user-product.patch @@ -1,16 +1,16 @@ diff --git a/src/main.ts b/src/main.ts -index 62ddd5f..7c21b8f 100644 +index ff9a5e8..2135d00 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,2 +8,3 @@ import * as fs from 'original-fs'; import * as os from 'os'; +import { createRequire } from 'node:module'; - import { configurePortable } from './bootstrap-node.js'; -@@ -23,2 +24,3 @@ import { NativeParsedArgs } from './vs/platform/environment/common/argv.js'; + import { performance } from 'perf_hooks'; +@@ -24,2 +25,3 @@ import { NativeParsedArgs } from './vs/platform/environment/common/argv.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const require = createRequire(import.meta.url); -@@ -103,2 +105,14 @@ registerListeners(); +@@ -112,2 +114,14 @@ registerListeners(); +function resolveUserProduct() { + const userProductPath = path.join(userDataPath, 'product.json'); @@ -25,7 +25,7 @@ index 62ddd5f..7c21b8f 100644 +} + /** -@@ -174,2 +188,3 @@ async function startup(codeCachePath: string | undefined, nlsConfig: INLSConfigu +@@ -183,2 +197,3 @@ async function startup(codeCachePath: string | undefined, nlsConfig: INLSConfigu process.env['VSCODE_CODE_CACHE_PATH'] = codeCachePath || ''; + resolveUserProduct();