mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-18 20:30:08 +08:00
feat: support node test
This commit is contained in:
parent
eeeaddbb60
commit
b1417f9b56
@ -119,6 +119,9 @@ export function getDefaultQQVersionConfigInfo (): QQVersionConfigType {
|
||||
}
|
||||
|
||||
export function getQQPackageInfoPath (exePath: string = '', version?: string): string {
|
||||
if (process.env['NAPCAT_QQ_PACKAGE_INFO_PATH']) {
|
||||
return process.env['NAPCAT_QQ_PACKAGE_INFO_PATH'];
|
||||
}
|
||||
let packagePath;
|
||||
if (os.platform() === 'darwin') {
|
||||
packagePath = path.join(path.dirname(exePath), '..', 'Resources', 'app', 'package.json');
|
||||
@ -135,6 +138,9 @@ export function getQQPackageInfoPath (exePath: string = '', version?: string): s
|
||||
}
|
||||
|
||||
export function getQQVersionConfigPath (exePath: string = ''): string | undefined {
|
||||
if (process.env['NAPCAT_QQ_VERSION_CONFIG_PATH']) {
|
||||
return process.env['NAPCAT_QQ_VERSION_CONFIG_PATH'];
|
||||
}
|
||||
let configVersionInfoPath;
|
||||
if (os.platform() === 'win32') {
|
||||
configVersionInfoPath = path.join(path.dirname(exePath), 'versions', 'config.json');
|
||||
|
||||
@ -43,6 +43,12 @@ export enum NapCatCoreWorkingEnv {
|
||||
}
|
||||
|
||||
export function loadQQWrapper (QQVersion: string): WrapperNodeApi {
|
||||
if (process.env['NAPCAT_WRAPPER_PATH']) {
|
||||
const wrapperPath = process.env['NAPCAT_WRAPPER_PATH'];
|
||||
const nativemodule: { exports: WrapperNodeApi; } = { exports: {} as WrapperNodeApi };
|
||||
process.dlopen(nativemodule, wrapperPath);
|
||||
return nativemodule.exports;
|
||||
}
|
||||
let appPath;
|
||||
if (os.platform() === 'darwin') {
|
||||
appPath = path.resolve(path.dirname(process.execPath), '../Resources/app');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user