Skip to content

Commit 2b74795

Browse files
committed
fix: Windows special build path
1 parent 3e23840 commit 2b74795

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ export const MODEL_OBJECT = {
4545
export const DEFAULT_MODEL = 'tiny.en'
4646

4747
export const WHISPER_CPP_PATH = path.join(__dirname, '..', 'cpp', 'whisper.cpp')
48-
export const WHISPER_CPP_MAIN_PATH = './build/bin/whisper-cli'
48+
49+
export const WHISPER_CPP_MAIN_PATH =
50+
process.platform === 'win32' ? 'build\\bin\\Release\\whisper-cli.exe' : './build/bin/whisper-cli'

src/whisper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ export async function whisperShell(
5353
export async function executeCppCommand(command: string, logger = console, withCuda: boolean): Promise<string> {
5454
try {
5555
shell.cd(WHISPER_CPP_PATH)
56-
if (!shell.which(WHISPER_CPP_MAIN_PATH)) {
56+
if (!shell.which(WHISPER_CPP_MAIN_PATH.replace(/\\/g, '/'))) {
5757
logger.debug('[Nodejs-whisper] whisper.cpp not initialized.')
5858

5959
const makeCommand = withCuda ? 'WHISPER_CUDA=1 make -j' : 'make -j'
6060
shell.exec(makeCommand)
6161

62-
if (!shell.which(WHISPER_CPP_MAIN_PATH)) {
62+
if (!shell.which(WHISPER_CPP_MAIN_PATH.replace(/\\/g, '/'))) {
6363
throw new Error(
6464
"[Nodejs-whisper] 'make' command failed. Please run 'make' command in /whisper.cpp directory."
6565
)

0 commit comments

Comments
 (0)