Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"files": {
"ignore": ["package.json", "__test__/*.json"]
"ignore": ["package.json", "__test__/*.json", "dist"]
},
"linter": {
"enabled": true,
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ async function run(): Promise<void> {
const result = await (async () => {
const installed = await installer.checkInstalled(version);
if (installed) {
core.info(`Edge ${version} is already installed @ ${installed.root}`);
const bin = path.join(installed.root, installed.bin);
core.info(`Edge ${version} is already installed @ ${bin}`);
return installed;
}

Expand Down
22 changes: 16 additions & 6 deletions src/installer_mac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,32 @@ export class MacInstaller implements Installer {
await exec.exec("gzip", ["--decompress", "App.gz"], { cwd: pkgroot });
await exec.exec("cpio", ["--extract", "--file", "App"], { cwd: pkgroot });

const app = path.join(pkgroot, this.appName(version));
const root = await tc.cacheDir(app, "msedge", version);
// tc.cacheDir copies the *contents* of the source dir into the cache root,
// so we wrap the .app inside a subdirectory to preserve the .app name and
// extension. Without this, the bundle root in the cache lacks the .app
// suffix and Edge refuses to launch (exits with null on macOS 15+).
const wrapperDir = path.join(extdir, "wrapper");
await fs.promises.mkdir(wrapperDir);
await fs.promises.rename(
path.join(pkgroot, this.appName(version)),
path.join(wrapperDir, this.appName(version)),
);

const root = await tc.cacheDir(wrapperDir, "msedge", version);

return { root, bin: this.binPath(version) };
}

private binPath(version: versions.Version): string {
switch (version) {
case versions.StableVersion:
return "Contents/MacOS/Microsoft Edge";
return "Microsoft Edge.app/Contents/MacOS/Microsoft Edge";
case versions.BetaVersion:
return "Contents/MacOS/Microsoft Edge Beta";
return "Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge Beta";
case versions.DevVersion:
return "Contents/MacOS/Microsoft Edge Dev";
return "Microsoft Edge Dev.app/Contents/MacOS/Microsoft Edge Dev";
case versions.CanaryVersion:
return "Contents/MacOS/Microsoft Edge Canary";
return "Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge Canary";
}
}

Expand Down
11 changes: 5 additions & 6 deletions src/installer_windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,11 @@ export class WindowsInstaller implements Installer {

async test(_version: versions.Version): Promise<void> {
const msedgeBin = await io.which("msedge", true);
await exec.exec("wmic", [
"datafile",
"where",
`name="${msedgeBin.replace(/\\/g, "\\\\")}"`,
"get",
"version",
await exec.exec("powershell", [
"-NoProfile",
"-NonInteractive",
"-Command",
`(Get-Item (Get-Command '${msedgeBin}').Source).VersionInfo.ProductVersion`,
]);
}
}
Loading