瀏覽代碼

update napi generated index.js

Chip Reed 2 年之前
父節點
當前提交
89a04e968f
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11 1
      tooling/cli/node/index.js

+ 11 - 1
tooling/cli/node/index.js

@@ -15,7 +15,8 @@ function isMusl() {
   // For Node 10
   if (!process.report || typeof process.report.getReport !== 'function') {
     try {
-      return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
+      const lddPath = require('child_process').execSync('which ldd').toString().trim();
+      return readFileSync(lddPath, 'utf8').includes('musl')
     } catch (e) {
       return true
     }
@@ -105,6 +106,15 @@ switch (platform) {
     }
     break
   case 'darwin':
+    localFileExisted = existsSync(join(__dirname, 'cli.darwin-universal.node'))
+    try {
+      if (localFileExisted) {
+        nativeBinding = require('./cli.darwin-universal.node')
+      } else {
+        nativeBinding = require('@tauri-apps/cli-darwin-universal')
+      }
+      break
+    } catch {}
     switch (arch) {
       case 'x64':
         localFileExisted = existsSync(join(__dirname, 'cli.darwin-x64.node'))