GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(keyring): target-platform path rules for packaged addon candidate… · lidge-jun/opencodex@540af24

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/lib
    • keyring-native.ts
  • tests/ci-workflows
    • keyring-smoke.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/lib/keyring-native.ts‎

Copy file name to clipboardExpand all lines: src/lib/keyring-native.ts
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { existsSync } from "node:fs";
22
import { createRequire } from "node:module";
3-
import { basename, dirname, join, resolve } from "node:path";
3+
import { posix, win32 } from "node:path";
44
import { isStandaloneBinary, standaloneRoot } from "./standalone";
55

66
export interface KeyringBinding {
@@ -74,6 +74,9 @@ export function packagedKeyringCandidates({
7474
if (root === undefined) return [];
7575
const asset = runtimeAsset(platform, arch);
7676
if (!asset) return [];
77+
// Paths follow the target platform's rules rather than the host's, so a candidate list is the
78+
// same whether it is computed on that platform or simulated from another one.
79+
const { basename, dirname, join, resolve } = platform === "win32" ? win32 : posix;
7780
const executableDir = resolve(root);
7881
const adjacent = join(executableDir, "keyring", asset.filename);
7982
if (platform === "linux") {
Collapse file

‎tests/ci-workflows/keyring-smoke.test.ts‎

Copy file name to clipboardExpand all lines: tests/ci-workflows/keyring-smoke.test.ts
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ describe("packaged keyring native binding", () => {
199199
.toEqual(["/opt/ocx/keyring/keyring.linux-x64-gnu.node"]);
200200
});
201201

202+
test("candidate paths follow the target platform's rules on any host", () => {
203+
expect(packagedKeyringCandidates({ root: "C:\\Program Files\\OpenCodex", platform: "win32", arch: "x64" }))
204+
.toEqual(["C:\\Program Files\\OpenCodex\\keyring\\keyring.win32-x64-msvc.node"]);
205+
expect(packagedKeyringCandidates({ root: "/opt/ocx", platform: "linux", arch: "x64" }))
206+
.toEqual(["/opt/ocx/keyring/keyring.linux-x64-gnu.node"]);
207+
});
208+
202209
test("loads only an existing deterministic packaged path and never consults cwd", () => {
203210
const binding = { Entry: class {}, AsyncEntry: class {} } as unknown as KeyringBinding;
204211
const calls: string[] = [];

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.