fix: WHISPER_CPP_MAIN_PATH constant in win32 platform & define execPath when using electron
This pull request introduces several modifications to the nodejs-whisper project to configure the shelljs library to utilize the Node.js executable path. The key changes include updates across multiple files to set shell.config.execPath to the Node.js executable path.
Configuration of shelljs:
src/autoDownloadModel.ts: Added configuration to setshell.config.execPathto the Node.js executable path.src/downloadModel.ts: Added configuration to setshell.config.execPathto the Node.js executable path.src/utils.ts: Added configuration to setshell.config.execPathto the Node.js executable path.src/whisper.ts:Added configuration to setshell.config.execPathto the Node.js executable path.
Update to the WHISPER_CPP_MAIN_PATH constant:
src/constants.ts: Updated theWHISPER_CPP_MAIN_PATHfor the Windows platform by removing theReleasedirectory from the path.
Additional Reference:
For more information on shelljs compatibility with Electron and configuring the execPath, please refer to the ShellJS Electron compatibility wiki
+1 Needed this for electron
Also needed a fix for models directory, which you can see at my fork:
https://github.com/nickdebaise/nodejs-whisper.git
Thanks @moraxh! the Electron shelljs configuration is great and needed. however, the Windows path change conflicts with our recent CMake improvements.
could you please keep the shell.config.execPath changes
and revert the WHISPER_CPP_MAIN_PATH change
Thanks @nickdebaise that path resolution fix look useful for Electron/webpack scenarios. I'll create a separate PR to address this properly.