From 75a68f6cad557879be41f8ce3b198c915938e83e Mon Sep 17 00:00:00 2001 From: agracio Date: Thu, 26 Sep 2024 19:01:44 +0100 Subject: [PATCH] updating install tools for Electron 32 --- tools/install.js | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/tools/install.js b/tools/install.js index dcd0ef9..6f9271e 100644 --- a/tools/install.js +++ b/tools/install.js @@ -3,7 +3,7 @@ var fs = require('fs') , spawn = require('child_process').spawn , whereis = require('./whereis'); -if (process.platform === 'win32') { +if (process.platform === 'win322') { var libroot = path.resolve(__dirname, '../lib/native/win32') , lib32bit = path.resolve(libroot, 'ia32') , lib64bit = path.resolve(libroot, 'x64') @@ -136,14 +136,37 @@ else { } if (version !== null) { - spawn('node-gyp', ['configure', '--target='+version, '--runtime=electron', '--disturl=https://electronjs.org/headers'], { stdio: 'inherit' }); - + const configure = spawn('node-gyp', ['configure', '--target='+version, '--runtime=electron', '--disturl=https://electronjs.org/headers', '--release'], { stdio: 'inherit' }); + var files = ['build/build_managed.vcxproj','build/edge_coreclr.vcxproj', 'build/edge_nativeclr.vcxproj']; + + const processPromises = files.map(file => { + const res = spawn('sed', ['-i', '-e', 's/std:c++17/std:c++20/g', file], { stdio: 'inherit' }); + + return new Promise((resolve, reject) => { + res.on("close", code => { + if (code === successCode) { + resolve(code) + } else { + reject(code) + } + }); + }); + }); + + // if(version.startsWith('32')){ + // configure.on('close', (code) => { + // spawn('sed', ['-i', '-e', 's/std:c++17/std:c++20/g', 'build/build_managed.vcxproj'], { stdio: 'inherit' }); + // spawn('sed', ['-i', '-e', 's/std:c++17/std:c++20/g', 'build/edge_coreclr.vcxproj'], { stdio: 'inherit' }); + // spawn('sed', ['-i', '-e', 's/std:c++17/std:c++20/g', 'build/edge_nativeclr.vcxproj'], { stdio: 'inherit' }); + // }); + // } if(version.startsWith('32')){ - spawn("sed -i -e 's/std:c++17/std:c++20/g' build/build_managed.vcxproj", { stdio: 'inherit' }); - spawn("sed -i -e 's/std:c++17/std:c++20/g' build/edge_coreclr.vcxproj", { stdio: 'inherit' }); - spawn("sed -i -e 's/std:c++17/std:c++20/g' build/edge_nativeclr.vcxproj", { stdio: 'inherit' }); + + }else{ + configure.on('close', (code) => { + spawn('node-gyp', ['build'], { stdio: 'inherit' }); + }); } - spawn('node-gyp', ['build'], { stdio: 'inherit' }); } else spawn('node-gyp', ['configure', 'build'], { stdio: 'inherit' });