Skip to content
Open
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
6 changes: 5 additions & 1 deletion packages/ios-node-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ if (typeof interop === "undefined") {

const module = { exports: {} };

// `URL.pathname` is percent-encoded, but `process.dlopen` takes a filesystem path. Without
// decoding, a space in the path arrives as "%20" and the load fails with "no such file" —
// which happens for any app bundle whose path contains a space, e.g.
// /Applications/My App.app/… → /Applications/My%20App.app/…
// deno-lint-ignore no-process-globals
process.dlopen(module, new URL(path, metaURL).pathname);
process.dlopen(module, decodeURIComponent(new URL(path, metaURL).pathname));

module.exports.init(
// deno-lint-ignore no-process-globals
Expand Down
14 changes: 10 additions & 4 deletions packages/macos-node-api/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ if (!isNativeScriptRuntime) {
// ===

const module = { exports: {} };
// `URL.pathname` is percent-encoded, but `process.dlopen` takes a filesystem path. Without
// decoding, a space in the path arrives as "%20" and the load fails with "no such file" —
// which happens for any app bundle whose path contains a space, e.g.
// /Applications/My App.app/… → /Applications/My%20App.app/…
process.dlopen(
module,
new URL(
"./build/RelWithDebInfo/NativeScript.apple.node/macos-arm64/NativeScript.framework/Versions/A/NativeScript",
`file://${__filename}`,
).pathname,
decodeURIComponent(
new URL(
"./build/RelWithDebInfo/NativeScript.apple.node/macos-arm64/NativeScript.framework/Versions/A/NativeScript",
`file://${__filename}`,
).pathname,
),
);
module.exports.init(process.env.METADATA_PATH);
} else if (typeof require !== "undefined") {
Expand Down
6 changes: 5 additions & 1 deletion packages/macos-node-api/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ if (!isNativeScriptRuntime) {

const module = { exports: {} };

// `URL.pathname` is percent-encoded, but `process.dlopen` takes a filesystem path. Without
// decoding, a space in the path arrives as "%20" and the load fails with "no such file" —
// which happens for any app bundle whose path contains a space, e.g.
// /Applications/My App.app/… → /Applications/My%20App.app/…
// deno-lint-ignore no-process-globals
process.dlopen(module, new URL(path, metaURL).pathname);
process.dlopen(module, decodeURIComponent(new URL(path, metaURL).pathname));

module.exports.init(
// deno-lint-ignore no-process-globals
Expand Down
Loading