mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-05 15:11:15 +00:00
Refactor addon path resolution and rename Windows addon
Simplifies the logic for resolving the ffmpeg addon path by dynamically constructing the filename from process.platform and process.arch. Also renames the Windows x64 addon file to ffmpegAddon.win32.x64.node for consistency.
This commit is contained in:
parent
e88f49e140
commit
7ac7488d54
@ -19,20 +19,12 @@ function getAddonPath(binaryPath: string): string {
|
||||
const platformName = platform();
|
||||
const archName = arch();
|
||||
|
||||
let addonFileName: string;
|
||||
|
||||
if (platformName === 'win32' && archName === 'x64') {
|
||||
addonFileName = 'ffmpegAddon.win.x64.node';
|
||||
} else if (platformName === 'linux' && archName === 'x64') {
|
||||
addonFileName = 'ffmpegAddon.linux.x64.node';
|
||||
} else if (platformName === 'linux' && archName === 'arm64') {
|
||||
addonFileName = 'ffmpegAddon.linux.arm64.node';
|
||||
} else if (platformName === 'darwin' && archName === 'arm64') {
|
||||
addonFileName = 'ffmpegAddon.darwin.arm64.node';
|
||||
} else {
|
||||
let addonFileName: string = process.platform + '.' + process.arch;
|
||||
let addonPath = path.join(binaryPath, "./native/ffmpeg/", `${addonFileName}.node`);
|
||||
if (existsSync(addonPath)) {
|
||||
throw new Error(`Unsupported platform: ${platformName} ${archName}`);
|
||||
}
|
||||
return path.join(binaryPath, "./native/ffmpeg/", addonFileName);
|
||||
return addonPath;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user