mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 00:59:03 +01:00
fix: rename product executable on macOS (#291948)
* fix: rename product executable name on macOS * chore: update test/automation/src/electron.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: update test/automation/src/electron.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: rename in additional places * chore: rename in code-perf.js * chore: create symlink for backwards compatibility --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -121,13 +121,22 @@ function findFilePath(root: string, path: string): string {
|
||||
throw new Error(`Could not find ${path} in any subdirectory`);
|
||||
}
|
||||
|
||||
function parseVersion(version: string) {
|
||||
const match = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
|
||||
if (!match) {
|
||||
throw new Error(`Invalid version string: ${version}`);
|
||||
}
|
||||
const [, major, minor, patch] = match;
|
||||
return { major: parseInt(major), minor: parseInt(minor), patch: parseInt(patch) };
|
||||
}
|
||||
|
||||
export function getDevElectronPath(): string {
|
||||
const buildPath = join(root, '.build');
|
||||
const product = require(join(root, 'product.json'));
|
||||
|
||||
switch (process.platform) {
|
||||
case 'darwin':
|
||||
return join(buildPath, 'electron', `${product.nameLong}.app`, 'Contents', 'MacOS', 'Electron');
|
||||
return join(buildPath, 'electron', `${product.nameLong}.app`, 'Contents', 'MacOS', `${product.nameShort}`);
|
||||
case 'linux':
|
||||
return join(buildPath, 'electron', `${product.applicationName}`);
|
||||
case 'win32':
|
||||
@@ -139,8 +148,20 @@ export function getDevElectronPath(): string {
|
||||
|
||||
export function getBuildElectronPath(root: string): string {
|
||||
switch (process.platform) {
|
||||
case 'darwin':
|
||||
return join(root, 'Contents', 'MacOS', 'Electron');
|
||||
case 'darwin': {
|
||||
const packageJson = require(join(root, 'Contents', 'Resources', 'app', 'package.json'));
|
||||
const product = require(join(root, 'Contents', 'Resources', 'app', 'product.json'));
|
||||
const { major, minor } = parseVersion(packageJson.version);
|
||||
// For macOS builds using the legacy Electron binary name, versions up to and including
|
||||
// 1.109.x ship the executable as "Electron". From later versions onward, the executable
|
||||
// is renamed to match product.nameShort. This check preserves compatibility with older
|
||||
// builds; update the cutoff here only if the binary naming scheme changes again.
|
||||
if (major === 1 && minor <= 109) {
|
||||
return join(root, 'Contents', 'MacOS', 'Electron');
|
||||
} else {
|
||||
return join(root, 'Contents', 'MacOS', product.nameShort);
|
||||
}
|
||||
}
|
||||
case 'linux': {
|
||||
const product = require(join(root, 'resources', 'app', 'product.json'));
|
||||
return join(root, product.applicationName);
|
||||
|
||||
Reference in New Issue
Block a user