From 94dec016d7cb06ff404e03b128ce67cd6de45257 Mon Sep 17 00:00:00 2001 From: Georgi Davidkov Date: Wed, 6 Nov 2024 21:39:17 +0200 Subject: [PATCH] apply the fix not only for win32 --- tools/updatenan.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/updatenan.js b/tools/updatenan.js index 7966c93..00deb6e 100644 --- a/tools/updatenan.js +++ b/tools/updatenan.js @@ -1,9 +1,8 @@ const spawn = require('child_process').spawn const existsSync = require('fs').existsSync - +const nanPath = existsSync('./node_modules/nan/nan.h') ? './node_modules/nan/nan.h' : '../nan/nan.h' if (process.platform === 'win32') { - const nanPath = existsSync('./node_modules/nan/nan.h') ? './node_modules/nan/nan.h' : '../nan/nan.h' spawn('powershell', ['-Command', `(Get-Content -Raw ${nanPath}) -replace '#include \"nan_scriptorigin.h\"', '// #include \"nan_scriptorigin.h\"' | Out-File -Encoding Utf8 ${nanPath}`], { stdio: 'inherit' }) } else { - spawn('sed', ['-i', '-e', 's/^#include .nan_scriptorigin\\.h./\\/\\/ #include nan_scriptorigin.h/', './node_modules/nan/nan.h'], { stdio: 'inherit' }) + spawn('sed', ['-i', '-e', 's/^#include .nan_scriptorigin\\.h./\\/\\/ #include nan_scriptorigin.h/', nanPath], { stdio: 'inherit' }) } \ No newline at end of file